@Override public void addTransactionCommitAdvice(MethodAdviceReceiver receiver) { for (final Method m : receiver.getInterface().getMethods()) { if (m.getAnnotation(CommitAfter.class) != null) { PersistenceContext annotation = receiver.getMethodAnnotation(m, PersistenceContext.class); receiver.adviseMethod(m, methodAdvices.get(annotation == null ? null : annotation.unitName())); } } }
@Override public void addOperationAdvice(MethodAdviceReceiver receiver) { for (Method m : receiver.getInterface().getMethods()) { Operation annotation = receiver.getMethodAnnotation(m, Operation.class); if (annotation != null) { String value = annotation.value(); receiver.adviseMethod(m, createAdvice(value)); } } }
@Override public void addOperationAdvice(MethodAdviceReceiver receiver) { for (Method m : receiver.getInterface().getMethods()) { Operation annotation = receiver.getMethodAnnotation(m, Operation.class); if (annotation != null) { String value = annotation.value(); receiver.adviseMethod(m, createAdvice(value)); } } }
private static void advise(Class<? extends Annotation> annotationClass, ObjectLocator objectLocator, Class<? extends CacheMethodAdvice> adviceClass, MethodAdviceReceiver methodAdviceReceiver) { // TAP5-2466: create the advice on-demand to avoid recursion issues MethodAdvice advice = null; if (methodAdviceReceiver.getClassAnnotationProvider().getAnnotation(annotationClass) != null) { advice = build(objectLocator, adviceClass); methodAdviceReceiver.adviseAllMethods(advice); } else { for (Method method : methodAdviceReceiver.getInterface().getMethods()) { if (methodAdviceReceiver.getMethodAnnotation(method, annotationClass) != null) { if(advice== null) { advice = build(objectLocator, adviceClass); } methodAdviceReceiver.adviseMethod(method, advice); } } } }