use of org.apache.tapestry5.jcache.internal.CacheMethodAdvice in project tapestry-5 by apache.
the class JCacheModule method advise.
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);
}
}
}
}
Aggregations