use of com.newrelic.agent.instrumentation.methodmatchers.LambdaMethodMatcher in project newrelic-java-agent by newrelic.
the class ExtensionConversionUtility method createMethodMatcher.
/**
* Creates the method matcher to be used in the point cut.
*
* @param cut The xml information about the methods contain in the point cut.
* @param pExtName The name of this extension.
* @param classesToMethods The class/method combos which have already appeared.
* @return The matcher to be used for methods on the point cut.
* @throws XmlException
*/
private static MethodMatcher createMethodMatcher(final Pointcut cut, final String pExtName, final Map<String, MethodMapper> classesToMethods) throws XmlException {
List<Method> methods = cut.getMethod();
List<String> traceReturnTypeDescriptors = cut.getTraceReturnTypeDescriptors();
if (methods != null && !methods.isEmpty()) {
return MethodMatcherUtility.createMethodMatcher(getClassName(cut), methods, classesToMethods, pExtName);
} else if (cut.getMethodAnnotation() != null) {
return new AnnotationMethodMatcher(Type.getObjectType(cut.getMethodAnnotation().replace('.', '/')));
} else if (cut.isTraceLambda()) {
return new LambdaMethodMatcher(cut.getPattern(), cut.getIncludeNonstatic());
} else if (traceReturnTypeDescriptors != null && !traceReturnTypeDescriptors.isEmpty()) {
return new ReturnTypeMethodMatcher(traceReturnTypeDescriptors);
} else {
throw new XmlException(MessageFormat.format(XmlParsingMessages.NO_METHOD, pExtName));
}
}
Aggregations