Top Description Methods
com.google.inject.spi

public Interface Element

Known Direct Subinterfaces
com.google.inject.spi.PrivateElements, com.google.inject.Binding
Known Direct Implementers
com.google.inject.spi.InjectionRequest, com.google.inject.spi.InterceptorBinding, com.google.inject.spi.MembersInjectorLookup, com.google.inject.spi.Message, com.google.inject.spi.ModuleAnnotatedMethodScannerBinding, com.google.inject.spi.ProviderLookup, com.google.inject.spi.ProvisionListenerBinding, com.google.inject.spi.RequireAtInjectOnConstructorsOption, com.google.inject.spi.RequireExactBindingAnnotationsOption, com.google.inject.spi.RequireExplicitBindingsOption, com.google.inject.spi.ScopeBinding, com.google.inject.spi.StaticInjectionRequest, com.google.inject.spi.TypeConverterBinding, com.google.inject.spi.TypeListenerBinding, com.google.inject.spi.DisableCircularProxiesOption
Imports
com.google.inject.Binder

A core component of a module or injector.

The elements of a module can be inspected, validated and rewritten. Use Elements.getElements() to read the elements from a module, and Elements.getModule() to rewrite them. This can be used for static analysis and generation of Guice modules.

The elements of an injector can be inspected and exercised. Use Injector.getBindings() to reflect on Guice injectors.

Authors
[email protected] (Jesse Wilson), [email protected] (Bob Lee)
Since
2.0

Method Summary

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

Accepts an element visitor.

public void
applyTo(Binder
to apply configuration element to
binder
)

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

public Object
getSource()

Returns an arbitrary object containing information about the "place" where this element was configured.

Method Detail

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

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

Parameters
visitor:ElementVisitor<T>

to call back on

applyToback to summary
public void applyTo(Binder binder)

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

Parameters
binder:Binder

to apply configuration element to

Exceptions
UnsupportedOperationException:
if the applyTo method is not supported by this element.
getSourceback to summary
public Object 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.