[jboss-user] [JBoss AOP] - Intercept Annonation with argument

DerMas do-not-reply at jboss.com
Thu Oct 16 04:16:27 EDT 2008


I'd like to define a pointcut which intercepts only annotations with a specified argument.

I have this annotation:

  | public @interface myAnnotation {
  | 	
  | 	MyValue value() default MyValue.CONSTANT;
  | 	
  | }
  | 

So a annotated method would look like this:


  | 	@myAnnotation (MyValue.BAR)
  | 	public void foo() {
  | 		System.out.println("HelloWorld");
  | 	}
  | 

To define a pointcut which intercepts all @myAnnotation(..) annotated methods, i use:


  | @Bind (pointcut="execution(* *->@annotation.MyAnnotation(..))")
  | 

But how can I define a pointcut which intercepts only classes with the argument MyValue.BAR?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4182564#4182564

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4182564



More information about the jboss-user mailing list