There's unfortunately no good way right now to get all MethodInterceptors
from a live injector, nor from a Module.  You can use the SPI to reprocess
the Modules and scan for
InterceptorBindings<http://google-guice.googlecode.com/svn/trunk/latest-javadoc/com/google/inject/spi/InterceptorBinding.html>.
 It should be possible to patch Guice to expose InterceptorBindings from an
Injector, but I don't think there's a built-in way we could let you get the
data within a Module itself.

The typical way that a lot of hooks use is to override the methods in
Binder to return a custom LinkedBindingBuilder (or in your case, just
override the bindInterceptor method?), and supply your users with a
AbstractCustomModule, and force them to use that.  Then the custom module
delegates to the real binder & also keeps track of what the user's doing in
order to do some other stuff.

 sam




On Mon, Aug 12, 2013 at 1:27 PM, Isaiah van der Elst <
[email protected]> wrote:

> Basically, I need to know when the user binds a MethodInterceptor... The
> TypeListener doesn't really work because I don't get the binding type or
> the matchers that go along with the binding :\
>
> If there is some way to do this from within a Module (as apposed to out a
> module using the Elements SPI) that would awesome :)
>
> I was thinking of adding another listener to the Binder that listens for
> bindings. The the listening method signature would be something like:
>
> public void hear(Binding<?> binding);
>
>
> On Monday, August 12, 2013 10:08:44 AM UTC-7, Sam Berlin wrote:
>
>> Can you maybe describe what you're doing and what you're looking to do in
>> more detail?  I don't totally understand what you're asking.
>>
>>  sam
>>
>>
>> On Mon, Aug 12, 2013 at 1:07 PM, Isaiah van der Elst <
>> [email protected]> wrote:
>>
>>> Hi,
>>>
>>> I'm working on an extension, 
>>> guice-asynchronous<https://code.google.com/p/guice-asynchronous/>,
>>> that allows for asynchronous method calls. Currently the framework uses the
>>> Elements SPI mechanism to hijack bindings. I'm not really a fan for this
>>> approach.  I'd rather have a module that applies the behavior without any
>>> sort of hijacking. The problem is that I can't get the interceptor bindings
>>> & matchers from within a module. How hard would it be to get a binding
>>> listener into v4.0? If I found the time to implement it, what's the
>>> probability that it would actually end up in v4.0?
>>>
>>> thanks :)
>>>
>>> --
>>> 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...@**googlegroups.com.
>>> To post to this group, send email to [email protected].
>>>
>>> Visit this group at 
>>> http://groups.google.com/**group/google-guice<http://groups.google.com/group/google-guice>
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>> .
>>>
>>>
>>>
>>
>>  --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/google-guice.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to