On Wed, Sep 22, 2010 at 10:15 PM, Dhanji R. Prasanna <[email protected]>wrote:
> You could do it by binding two different instances and using an instance
> matcher.
Not sure I follow how that would work, can you elaborate? The
bindInterceptor signature right now is:
--
void bindInterceptor(Matcher<? super Class<?>> classMatcher,
Matcher<? super Method> methodMatcher,
org.aopalliance.intercept.MethodInterceptor... interceptors);
--
As I understand it (and I haven't used interceptors all that much, so this
could be way off), this means you can only match based on the class/method,
which wouldn't be able to disambiguate based on an instance. Though
thinking about it more, you could have a simple class matcher and have the
interceptors sometimes apply its interception code based on the object it
intercepted. But that would require you preconstruct your instances, so
would only work with singletons, and would be pretty hard if lots of
dependencies were required in the constructor.
sam
>
> Dhanji.
>
> On Thu, Sep 23, 2010 at 12:08 PM, Sam Berlin <[email protected]> wrote:
>
>> This is actually a deficiency in the Binder API right now -- interceptors
>> match based on Class (and Method), not Key. I looked into this a while ago
>> when someone asked a similar question internally, and there didn't seem to
>> be any reason within the implementation that it was limited to Class (as
>> opposed to Key), but changing it to Key would be a clunky API change (it
>> would require an additional method name... it can't be an overloaded method
>> because the limitation on Class is in the generics, and the generic types
>> would clash).
>>
>> sam
>>
>> On Wed, Sep 22, 2010 at 9:45 PM, Dhanji R. Prasanna <[email protected]>wrote:
>>
>>> The simple way to do it would be to bind the class to two different keys:
>>> one which gets intercepted and one that doesn't.
>>>
>>> Dhanji.
>>>
>>>
>>> On Wed, Sep 22, 2010 at 7:37 AM, Andrei Pozolotin <
>>> [email protected]> wrote:
>>>
>>>> Hello;
>>>>
>>>> SITUATOIN:
>>>>
>>>> when I use guice aop interceptor for a class:
>>>>
>>>> class Base { void call() {} }
>>>>
>>>> the guice aop will use cglib to produce a proxy derived class, such
>>>> as:
>>>>
>>>> class Base&&EnhancerByGuice$$12345678 extends Base { void call() {} }
>>>>
>>>> PROBLEM:
>>>>
>>>> how can I call original Base.call() method and NOT EnhancerByGuice?
>>>>
>>>> in the spirit of invokeSuper():
>>>>
>>>> http://cglib.sourceforge.net/apidocs/net/sf/cglib/MethodProxy.html#invokeSuper%28java.lang.Object,%20java.lang.Object[]%29
>>>>
>>>> Thank you;
>>>>
>>>> Andrei
>>>>
>>>> --
>>>> 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]<google-guice%[email protected]>
>>>> .
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/google-guice?hl=en.
>>>>
>>>>
>>> --
>>> 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]<google-guice%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-guice?hl=en.
>>>
>>
>> --
>> 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]<google-guice%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-guice?hl=en.
>>
>
> --
> 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]<google-guice%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-guice?hl=en.
>
--
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.