private static List<ParameterAttributeName> getParameterAttributeNames( final List<Extension.Instrumentation.Pointcut.Method> methods) { final List<ParameterAttributeName> reportedParams = (List<ParameterAttributeName>) Lists.newArrayList(); for (final Extension.Instrumentation.Pointcut.Method m : methods) { if (m.getParameters() != null && m.getParameters().getType() != null) { for (int i = 0; i < m.getParameters().getType().size(); ++i) { final Extension.Instrumentation.Pointcut.Method.Parameters.Type t = m.getParameters().getType().get(i); if (t.getAttributeName() != null) { try { final MethodMatcher methodMatcher = MethodMatcherUtility.createMethodMatcher( "DummyClassName", m, (Map<String, MethodMapper>) Maps.newHashMap(), ""); final ParameterAttributeName reportedParam = new ParameterAttributeName(i, t.getAttributeName(), methodMatcher); reportedParams.add(reportedParam); } catch (Exception e) { Agent.LOG.log(Level.FINEST, (Throwable) e, e.getMessage(), new Object[0]); } } } } } return reportedParams; }
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)); }