Announcement Announcement Module
Collapse
No announcement yet.
Parameter binding of meta-annotation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Parameter binding of meta-annotation

    Hi!
    How can I bind a captured meta-annotation like this?

    Code:
    @Pointcut("execution(@(@a.b.MyMethodAnnotation *) * *(..))")
    - '@annotation(myMethodAnnotation)' does NOT work when the method is annotated by an annotation that is annotated by a.b.MyMethodAnnotation.

    Thanks in advance.

  • #2
    I use an annotation for de/activating hibernate filters. The annotation is applied to DAO methods.
    Here is the Aspect, which binds the annotation:

    Code:
    @Aspect
    public class OeFullActiveFilterAspect {
    
        @SuppressWarnings("unchecked")
        @Around("execution(@OeFullActiveFilter * *.data.dao.impl.*.*(..)) "
                + "&& this(*.data.dao.GenericDao) && target(dao) && @annotation(filter)")
        public Object enableKdbActiveFilter(ProceedingJoinPoint pjp, GenericDao dao, OeFullActiveFilter filter)
                throws Throwable {
            dao.enableOeFullActiveFilter(filter.fullActive());
            Object ret = pjp.proceed();
            dao.disableOeFullActiveFilter();
            return ret;
        }
    }

    Comment

    Working...
    X