Пример #1
0
 private static ExtensionClassAndMethodMatcher createPointCut(
     final Extension extension,
     final Extension.Instrumentation.Pointcut cut,
     final String metricPrefix,
     final String pName,
     final Map<String, MethodMapper> classesToMethods,
     final boolean custom,
     final InstrumentationType type,
     final boolean isAttsEnabled)
     throws XmlException {
   ClassMatcher classMatcher;
   if (cut.getMethodAnnotation() != null) {
     classMatcher = new AllClassesMatcher();
   } else {
     classMatcher = createClassMatcher(cut, pName);
   }
   final MethodMatcher methodMatcher = createMethodMatcher(cut, pName, classesToMethods);
   List<ParameterAttributeName> reportedParams = null;
   if (!isAttsEnabled) {
     reportedParams = (List<ParameterAttributeName>) Lists.newArrayList();
   } else {
     reportedParams = getParameterAttributeNames(cut.getMethod());
   }
   return new ExtensionClassAndMethodMatcher(
       extension, cut, metricPrefix, classMatcher, methodMatcher, custom, reportedParams, type);
 }
Пример #2
0
 private static MethodMatcher createMethodMatcher(
     final Extension.Instrumentation.Pointcut cut,
     final String pExtName,
     final Map<String, MethodMapper> classesToMethods)
     throws XmlException {
   final List<Extension.Instrumentation.Pointcut.Method> methods = cut.getMethod();
   if (methods != null && !methods.isEmpty()) {
     return MethodMatcherUtility.createMethodMatcher(
         getClassName(cut), methods, classesToMethods, pExtName);
   }
   if (cut.getMethodAnnotation() != null) {
     return new AnnotationMethodMatcher(
         Type.getObjectType(cut.getMethodAnnotation().replace('.', '/')));
   }
   throw new XmlException(
       MessageFormat.format(
           "At least one method must be specified for each point cut in the extension {0}",
           pExtName));
 }