Interface | Description |
---|---|
ParameterKeys |
Useful
Key s for binding Parameters . |
WireModule.Strategy |
Wiring strategy.
|
Wiring |
Something that can supply bindings for unresolved dependency
Key s. |
Class | Description |
---|---|
AbstractTypeConverter<T> |
Abstract
TypeConverter Module that automatically registers the converter based on the type argument. |
BeanProviders |
Supplies various bean
Provider s backed by dynamic bean lookups. |
ChildWireModule |
Child
WireModule that avoids wiring dependencies that already exist in a parent Injector . |
DependencyAnalyzer |
BindingTargetVisitor that collects the Key s of any injected dependencies. |
DependencyVerifier |
BindingTargetVisitor that verifies any injected dependencies. |
DynamicGlue |
Utility methods for generating dynamic
Provider -based proxies. |
ElementAnalyzer |
ElementVisitor that analyzes Binding s for unresolved injection dependencies. |
ElementMerger |
ElementVisitor that verifies Binding s and merges any duplicates. |
EntryListAdapter<V> |
List backed by an Iterable sequence of map entries. |
EntryListAdapter.ValueIterator<V> |
Value
Iterator backed by a Key:Value Iterator . |
EntryListAdapter.ValueListIterator<V> |
Value
ListIterator backed by a cached Key:Value Iterator . |
EntryMapAdapter<K,V> |
Map backed by an Iterable sequence of map entries. |
EntryMapAdapter.EntrySet<K,V> |
Entry
Set backed by an Iterable sequence of map entries. |
EntrySetAdapter<V> |
Set backed by an Iterable sequence of map entries. |
EntrySetAdapter.ValueIterator<V> |
Value
Iterator backed by a Key:Value Iterator . |
FileTypeConverter |
TypeConverter Module that converts constants to File s. |
GlueLoader |
Weak cache of
ClassLoader s that can generate proxy classes on-demand. |
LocatorWiring |
Adds
BeanLocator -backed bindings for unresolved bean dependencies. |
MergedModule |
Guice
Module that discards any duplicate or broken bindings. |
MergedProperties |
Delegating
Map that merges a series of Map s into one consistent view. |
NamedIterableAdapter<V> |
String mapping
Iterable backed by a Named mapping Iterable . |
NamedIterableAdapter.NamedEntry<V> |
String mapping
Map.Entry backed by a Named mapping Map.Entry . |
NamedIterableAdapter.NamedIterator<V> |
String mapping
Iterator backed by a Named mapping Iterator . |
PlaceholderBeanProvider<V> |
Provides a single bean; the name used to lookup/convert the bean is selected at runtime.
|
ProviderIterableAdapter<K extends java.lang.annotation.Annotation,V> | |
ProviderIterableAdapter.ProviderEntry<K extends java.lang.annotation.Annotation,V> | |
ProviderIterableAdapter.ProviderIterator<K extends java.lang.annotation.Annotation,V> | |
StringProperties |
Delegating
Map that ignores any non-String properties. |
TypeConverterCache |
Lazy cache of known
TypeConverter s. |
URLTypeConverter |
TypeConverter Module that converts constants to URL s. |
WireModule |
Guice
Module that automatically adds BeanLocator -backed bindings for unresolved dependencies. |
The WireModule
should enclose all modules in your application:
Guice.createInjector( new WireModule( bootModule, configModule, mainModule ) );Use the
ChildWireModule
when you want to wire child injectors:
injector.createChildInjector( new ChildWireModule( serviceModule, subModule ) );
LocatorWiring
which can supply the following bindings via the BeanLocator
:
@Inject MyType bean @Inject @Named("hint") MyType namedBean @Inject @MyQualifier MyType qualifiedBean @Inject Provider<MyType> beanProvider
@Inject @Named("${my.property.name}") File file // supports basic type conversion @Inject @Named("${my.property.name:-http://example.org/}") URL url // can give default in case property is not set @Inject @Named("${my.property.name:-development}") MyType bean // can be used to pick specific @Named beans @Inject @Named("my.property.name") int port // shorthand syntax
You can bind your configuration at runtime as follows:
bind( ParameterKeys.PROPERTIES
).toInstance( myConfiguration ); // multiple bindings are merged into one view
BeanLocator
.
They are also lazy, meaning instances are created as you access elements of the collection; the elements are then re-used for the same collection.
@Inject List<MyType> list
@Inject List<Provider<MyType>> providers
@Inject Iterable<BeanEntry
<MyQualifier, MyType>> entries // gives access to additional metadata
@Inject Map<String, MyType> stringMap // strings are taken from @Named values @Inject Map<Named, MyType> namedMap @Inject Map<MyQualifier, MyType> qualifiedMap @Inject Map<String, Provider<MyType>> providerMap