private boolean checkAnnotation(Advise annotation) { return annotation != null && "id".equals(annotation.id()) && NonAnnotatedServiceInterface.class.equals(annotation.serviceInterface()); }
private void addAdvisorDef(Method method) { Advise annotation = method.getAnnotation(Advise.class); Class serviceInterface = annotation == null ? null : annotation.serviceInterface(); // TODO: methods just named "decorate" String advisorId = annotation == null ? stripMethodPrefix(method, ADVISE_METHOD_NAME_PREFIX) : extractId( serviceInterface, annotation.id()); // TODO: Check for duplicates Class returnType = method.getReturnType(); if (!returnType.equals(void.class)) throw new RuntimeException(String.format("Advise method %s does not return void.", toString(method))); boolean found = false; for (Class pt : method.getParameterTypes()) { if (pt.equals(MethodAdviceReceiver.class)) { found = true; break; } } if (!found) throw new RuntimeException(String.format("Advise method %s must take a parameter of type %s.", toString(method), MethodAdviceReceiver.class.getName())); Set<Class> markers = extractMarkers(method, Advise.class); AdvisorDef def = new AdvisorDefImpl(method, extractPatterns(advisorId, method), extractConstraints(method), proxyFactory, advisorId, serviceInterface, markers); advisorDefs.put(advisorId, def); }
private void addAdvisorDef(Method method) { Advise annotation = method.getAnnotation(Advise.class); Class serviceInterface = annotation == null ? null : annotation.serviceInterface(); // TODO: methods just named "decorate" String advisorId = annotation == null ? stripMethodPrefix(method, ADVISE_METHOD_NAME_PREFIX) : extractId( serviceInterface, annotation.id()); // TODO: Check for duplicates Class returnType = method.getReturnType(); if (!returnType.equals(void.class)) throw new RuntimeException(String.format("Advise method %s does not return void.", toString(method))); boolean found = false; for (Class pt : method.getParameterTypes()) { if (pt.equals(MethodAdviceReceiver.class)) { found = true; break; } } if (!found) throw new RuntimeException(String.format("Advise method %s must take a parameter of type %s.", toString(method), MethodAdviceReceiver.class.getName())); Set<Class> markers = extractMarkers(method, Advise.class); AdvisorDef def = new AdvisorDefImpl(method, extractPatterns(advisorId, method), extractConstraints(method), proxyFactory, advisorId, serviceInterface, markers); advisorDefs.put(advisorId, def); }