Search in sources :

Example 1 with CacheMethodAdvice

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);
            }
        }
    }
}
Also used : CacheMethodAdvice(org.apache.tapestry5.jcache.internal.CacheMethodAdvice) CacheRemoveAllMethodAdvice(org.apache.tapestry5.jcache.internal.CacheRemoveAllMethodAdvice) CacheRemoveMethodAdvice(org.apache.tapestry5.jcache.internal.CacheRemoveMethodAdvice) MethodAdvice(org.apache.tapestry5.plastic.MethodAdvice) CacheResultMethodAdvice(org.apache.tapestry5.jcache.internal.CacheResultMethodAdvice) CachePutMethodAdvice(org.apache.tapestry5.jcache.internal.CachePutMethodAdvice) Method(java.lang.reflect.Method)

Aggregations

Method (java.lang.reflect.Method)1 CacheMethodAdvice (org.apache.tapestry5.jcache.internal.CacheMethodAdvice)1 CachePutMethodAdvice (org.apache.tapestry5.jcache.internal.CachePutMethodAdvice)1 CacheRemoveAllMethodAdvice (org.apache.tapestry5.jcache.internal.CacheRemoveAllMethodAdvice)1 CacheRemoveMethodAdvice (org.apache.tapestry5.jcache.internal.CacheRemoveMethodAdvice)1 CacheResultMethodAdvice (org.apache.tapestry5.jcache.internal.CacheResultMethodAdvice)1 MethodAdvice (org.apache.tapestry5.plastic.MethodAdvice)1