com.google.inject.Binding<T> |
Known Indirect Subclasses
ConstructorBinding<T>,
ConvertedConstantBinding<T>,
ExposedBinding<T>,
InstanceBinding<T>,
LinkedKeyBinding<T>,
ProviderBinding<T extends Provider<?>>,
ProviderInstanceBinding<T>,
ProviderKeyBinding<T>,
UntargettedBinding<T>
|
A mapping from a key (type and optional annotation) to the strategy for getting instances of the type. This interface is part of the introspection API and is intended primarily for use by tools.
Bindings are created in several ways:
bind()
and bindConstant()
statements:
bind(Service.class).annotatedWith(Red.class).to(ServiceImpl.class); bindConstant().annotatedWith(ServerHost.class).to(args[0]);
pointer
annotations
or by using its annotated
or
default constructor.providers
, by delegating to the binding for the provided type.They exist on both modules and on injectors, and their behaviour is different for each:
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Accepts a scoping visitor.
| |||||||||||
Accepts a target visitor.
| |||||||||||
Returns the key for this binding.
| |||||||||||
Returns the scoped provider guice uses to fulfill requests for this
binding.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.google.inject.spi.Element
|
Accepts a scoping visitor. Invokes the visitor method specific to this binding's scoping.
visitor | to call back on |
---|
Accepts a target visitor. Invokes the visitor method specific to this binding's target.
visitor | to call back on |
---|
Returns the scoped provider guice uses to fulfill requests for this binding.
UnsupportedOperationException | when invoked on a Binding
created via getElements(Module...) . This
method is only supported on Binding s returned from an injector.
|
---|