I want to have a Guice interceptor that intercepts calls either to a class 
that is annotated, or a method that is annotated. I'd like to be able to 
combine both, ie. override the class annotation with a method annotation 
with different properties.

I have this working like this:

// Intercept all METHODS annotated with @MyAnnotation
bindInterceptor(
    Matchers.any(),
    Matchers.annotatedWith(company.MyAnnotation),
    new TracingInterceptor());

// Intercept all methods in CLASSES annotated with @MyAnnotation
bindInterceptor(
    Matchers.annotatedWith(company.MyAnnotation),
    Matchers.any(),
    new TracingInterceptor());

However when I annotate a class like this:

@MyAnnotation    
class MyClass {
    @MyAnnotation
    public void myMethod() {}
}

The interceptor gets called twice, which is bad!

Is there any way to avoid triggering the interceptor twice, but having the 
same behaviour?

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-guice+unsubscr...@googlegroups.com.
To post to this group, send email to google-guice@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/251e5c84-49e7-42f5-9549-3e1b08da6cf8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to