I have an annotation:
@Inherited
@InterceptorBinding
@Retention(RUNTIME)
@Target({METHOD, TYPE})
public @interface Example {
}
And the interceptor class to handle it:
@Interceptor
@Example
public class ExampleInterceptor implements Serializable {
...
}
I would like to add parameter text:
public @interface Example {
String text();
}
But I don't know how to handle a parameter in an interceptor class. How to change class annotation?
@Interceptor
@Example(text=???????)
public class ExampleInterceptor implements Serializable {
...
}
If I write @Example(text="my text"), the interceptor is called only when the method / class is annotated with @Example(text="my text"). But I want the interceptor to be called independently by the value of the - parameter @Example(text="other text").
And how to get the parameter value? Should I use reflection or is there a better way?
ziri source
share