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

public final Class ProvisionListenerBinding

extends Object
implements Element
Class Inheritance
All Implemented Interfaces
com.google.inject.spi.Element
Imports
com.google.common.collect.ImmutableList, com.google.inject.Binder, .Binding, com.google.inject.matcher.Matcher, java.util.List

Binds keys (picked using a Matcher) to a provision listener. Listeners are created explicitly in a module using Binder#bindListener(Matcher, ProvisionListener...) statements:
Author
[email protected] (Sam Berlin)
Since
4.0

Field Summary

Modifier and TypeField and Description
private final Matcher<? super Binding<?>>
private final List<ProvisionListener>
private final Object

Constructor Summary

AccessConstructor and Description
pack-priv
ProvisionListenerBinding(Object source, Matcher<? super Binding<?>> bindingMatcher, ProvisionListener[] listeners)

Method Summary

Modifier and TypeMethod and Description
public <R> R
acceptVisitor(ElementVisitor<R>
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 Binding<?>>
getBindingMatcher()

Returns the binding matcher which chooses which bindings the listener should be notified of.

public List<ProvisionListener>
getListeners()

Returns the registered listeners.

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

bindingMatcherback to summary
private final Matcher<? super Binding<?>> bindingMatcher
listenersback to summary
private final List<ProvisionListener> listeners
sourceback to summary
private final Object source

Constructor Detail

ProvisionListenerBindingback to summary
pack-priv ProvisionListenerBinding(Object source, Matcher<? super Binding<?>> bindingMatcher, ProvisionListener[] listeners)

Method Detail

acceptVisitorback to summary
public <R> R acceptVisitor(ElementVisitor<R> 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<R>

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
getBindingMatcherback to summary
public Matcher<? super Binding<?>> getBindingMatcher()

Returns the binding matcher which chooses which bindings the listener should be notified of.

getListenersback to summary
public List<ProvisionListener> getListeners()

Returns the registered listeners.

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