Announcement Announcement Module
Collapse
No announcement yet.
@annotation with special parameter as Pointcut Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @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
    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()
         }
    
    }

    Comment


    • #3
      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?

      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()
           }
      
      }

      Comment

      Working...
      X