Results 1 to 3 of 3

Thread: @annotation with special parameter as Pointcut

  1. #1
    Join Date
    Apr 2012
    Posts
    5

    Default @annotation with special parameter as Pointcut

    Hello every body,

    my methods are decorated with an annotation with parameter
    Code:
    @Validation(name="special")
    My Pointcut/Before are:
    Code:
     @Before("@annotation(de.xxx.xxx.Validation ()")
    I want to define an Pointcut with the Annotation and with special Parameter. I dont want to use the args-Argument and use the argument in the method.

    Can you help me oder give me an Advice?

  2. #2

    Default

    Any reason why you don't want to use the argument in the method?
    Code:
    @Before("@annotation(validation)")
    public void interceptValidation(Validation validation){
        if("special".equals(validation.name()){
             doSpecialValidation();
         }else{
             doNormalValidation()
         }
    
    }

  3. #3
    Join Date
    Apr 2012
    Posts
    5

    Default

    Hello,

    The Problem are the methods with various types of parameter. The suggested from you is a good idea, but
    i must need the parameter for validation. Have you got any Ideas?

    Quote Originally Posted by ozGuy View Post
    Any reason why you don't want to use the argument in the method?
    Code:
    @Before("@annotation(validation)")
    public void interceptValidation(Validation validation){
        if("special".equals(validation.name()){
             doSpecialValidation();
         }else{
             doNormalValidation()
         }
    
    }

Posting Permissions

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