Notice the first Matcher takes a <? super Class> and it decides if the
class is eligible for AOP. The second Matcher takes a <? super Method>
and it decides if it should intercept the method or not.

Nothing is stopping you from inspecting the method e.g.

new AbstractMatcher<Method>() {
                    public boolean matches(Method method) {
                        return method.getDeclaringClass().getPackage
() .... // decide if you like this method or not
                    }
                }


Cheers
Alen

On Jun 13, 3:02 pm, tchan <[email protected]> wrote:
> Hi;
>
> Has anyone worked with the AOP interceptors in Guice much?  I'm used
> to using full blown AspectJ in my other projects and am having
> difficulty reproducing some mix-in behaviour using plain AOP.
>
> I want to introduce a tracer on instance methods in certain packages.
> The catch is that I only want the logic applied to methods declared in
> those packages.  That is, skip methods defined in parent classes that
> reside outside of the target packages.
>
> So say class A resides in org.library and class B that extends A
> resides in my.project.  I want to only intercept methods defined in
> my.project.B and not any inherited method from org.library.A.
>
> Right now, I am using subpackageOf() as my class matcher and any() as
> my method matcher in my bind interceptor declaration.  This doesn't do
> what I want, it will apply to all methods in the subpackage, even
> inherited methods from classes outside the packages I state.
>
> Does anyone have any ideas on how to do this with a custom method
> matcher?  And if it can't be done statically, what about during
> runtime in the actual interceptor?
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to