Results 1 to 2 of 2

Thread: Advised method annotations

Hybrid View

  1. #1
    Join Date
    Dec 2009
    Posts
    8

    Default Advised method annotations

    I am quite newbie to AOP but I thought that I have not used a good waysful to get annotations adviced methods.

    I tried this

    Code:
     private ValidationEnabled getValidationEnabled(ProceedingJoinPoint jp) {
            Signature signature = jp.getSignature();
            Object[] objects = jp.getArgs();
            List<Class<?>> list = new ArrayList<Class<?>>();
            for (Object object : objects) {
                list.add(object.getClass());
            }
            Class s[] = new Class[objects.length];
            list.toArray(s);
            Method method = ReflectionUtils.findMethod(signature.getDeclaringType(), signature.getName(),s);
            return method.getAnnotation(ValidationEnabled.class);
        }


    And also I have used

    Code:
        @Around("@annotation(com.xxx.ValidationEnabled)")
        public Response check(ProceedingJoinPoint jp) {
    
        }


    Is there an easy way to get annotation which is adviced?

    Thanks

  2. #2
    Join Date
    Dec 2009
    Posts
    8

    Default

    Sorry to bother....


    @Around( "@annotation(myAnnotation)" )
    public Object doSomething(
    ProceedingJoinPoint pjp, MyAnnotation myAnnotation ) { }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •