Top Description Fields Constructors Methods
com.google.inject.spi

public final Class InterceptorBinding

extends Object
implements Element
Class Inheritance
All Implemented Interfaces
com.google.inject.spi.Element
Static Imports
com.google.common.base.Preconditions.checkNotNull

Registration of interceptors for matching methods of matching classes. Instances are created explicitly in a module using bindInterceptor() statements:
    bindInterceptor(Matchers.subclassesOf(MyAction.class),
        Matchers.annotatedWith(Transactional.class),
        new MyTransactionInterceptor());
or from an injectable type listener using TypeEncounter.bindInterceptor().
Author
[email protected] (Jesse Wilson)
Since
2.0

Field Summary

Modifier and TypeField and Description
private final Matcher<? super Class<?>>
private final ImmutableList<MethodInterceptor>
private final Matcher<? super Method>
private final Object

Constructor Summary

AccessConstructor and Description
pack-priv
InterceptorBinding(Object source, Matcher<? super Class<?>> classMatcher, Matcher<? super Method> methodMatcher, MethodInterceptor[] interceptors)

Method Summary

Modifier and TypeMethod and Description
public <T> T
acceptVisitor(ElementVisitor<T>
to call back on
visitor
)

Implements com.google.inject.spi.Element.acceptVisitor.

Accepts an element visitor.
public void
applyTo(Binder
to apply configuration element to
binder
)

Implements com.google.inject.spi.Element.applyTo.

Writes this module element to the given binder (optional operation).
public Matcher<? super Class<?>>
public List<MethodInterceptor>
public Matcher<? super Method>
public Object
getSource()

Implements com.google.inject.spi.Element.getSource.

Returns an arbitrary object containing information about the "place" where this element was configured.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classMatcherback to summary
private final Matcher<? super Class<?>> classMatcher
interceptorsback to summary
private final ImmutableList<MethodInterceptor> interceptors
methodMatcherback to summary
private final Matcher<? super Method> methodMatcher
sourceback to summary
private final Object source

Constructor Detail

InterceptorBindingback to summary
pack-priv InterceptorBinding(Object source, Matcher<? super Class<?>> classMatcher, Matcher<? super Method> methodMatcher, MethodInterceptor[] interceptors)

Method Detail

acceptVisitorback to summary
public <T> T acceptVisitor(ElementVisitor<T> visitor)

Implements com.google.inject.spi.Element.acceptVisitor.

Doc from com.google.inject.spi.Element.acceptVisitor.

Accepts an element visitor. Invokes the visitor method specific to this element's type.

Parameters
visitor:ElementVisitor<T>

to call back on

Annotations
@Override
applyToback to summary
public void applyTo(Binder binder)

Implements com.google.inject.spi.Element.applyTo.

Doc from com.google.inject.spi.Element.applyTo.

Writes this module element to the given binder (optional operation).

Parameters
binder:Binder

to apply configuration element to

Annotations
@Override
getClassMatcherback to summary
public Matcher<? super Class<?>> getClassMatcher()
getInterceptorsback to summary
public List<MethodInterceptor> getInterceptors()
getMethodMatcherback to summary
public Matcher<? super Method> getMethodMatcher()
getSourceback to summary
public Object getSource()

Implements com.google.inject.spi.Element.getSource.

Doc from com.google.inject.spi.Element.getSource.

Returns an arbitrary object containing information about the "place" where this element was configured. Used by Guice in the production of descriptive error messages.

Tools might specially handle types they know about; StackTraceElement is a good example. Tools should simply call toString() on the source object if the type is unfamiliar.

Annotations
@Override