| Interface | Description |
|---|---|
| AnnotatedSource |
Binding source locations can implement this interface to supply annotations to the
BeanLocator. |
| BeanLocator |
Finds and tracks bean implementations annotated with
Qualifier annotations. |
| BindingPublisher |
Publisher of
Bindings to interested BindingSubscribers. |
| BindingSubscriber<T> |
Subscriber of
Bindings from one or more BindingPublishers. |
| DeferredClass<T> |
Placeholder
Class; postpones classloading until absolutely necessary. |
| DeferredProvider<T> |
Provider backed by a DeferredClass. |
| Logs.Sink |
Something that accepts formatted messages.
|
| MildElements.Indexable |
Represents an element that can be indexed.
|
| MildValues.InverseMapping |
Represents an inverse mapping from a value to its key.
|
| MutableBeanLocator |
Mutable
BeanLocator that finds and tracks bindings across zero or more BindingPublishers. |
| RankingFunction |
Assigns each
Binding a rank according to some function; higher ranks take precedence over lower ranks. |
| Class | Description |
|---|---|
| BeanCache<Q extends java.lang.annotation.Annotation,T> |
Atomic cache mapping
Bindings to BeanEntrys; optimized for common case of single entries. |
| DefaultBeanLocator |
Default
MutableBeanLocator that locates qualified beans across a dynamic group of BindingPublishers. |
| DefaultRankingFunction |
Simple
RankingFunction that partitions qualified bindings into two main groups. |
| DescriptionSource |
Implementation of @
Description that can also act as an @AnnotatedSource. |
| Guice4 |
Utility methods for dealing with changes in the Guice 4.0 SPI.
|
| HiddenSource |
Implementation of @
Hidden that can also act as an @AnnotatedSource. |
| Implementations |
Utility methods for discovering the implementations behind Guice bindings.
|
| Implementations.ClassFinder |
BindingTargetVisitor that attempts to find the implementations behind bindings. |
| Implementations.ServletFinder |
Implementations.ClassFinder that can also peek behind servlet/filter bindings. |
| ImplicitBindings |
Source of "implicit" bindings; includes @
ImplementedBy, @ProvidedBy, and concrete types. |
| InjectorBindings | |
| LazyBeanEntry<Q extends java.lang.annotation.Annotation,T> |
Lazy
BeanEntry backed by a qualified Binding and an assigned rank. |
| LazyBeanEntry.JsrNamed |
Implementation of @
Named that can also act like @Named. |
| Legacy<S> | Deprecated
Limited support for migrating legacy types.
|
| LocatedBeans<Q extends java.lang.annotation.Annotation,T> |
Provides a sequence of
BeanEntrys by iterating over qualified Bindings. |
| Logs |
Utility methods for dealing with container logging and recovery.
|
| Logs.ConsoleSink |
Logs.Sinks messages to the system console. |
| Logs.JULSink |
Logs.Sinks messages to the JDK. |
| Logs.SLF4JSink |
Logs.Sinks messages via SLF4J. |
| MildConcurrentKeys<K,V> |
Thread-safe
Map whose keys are kept alive by soft/weak References. |
| MildConcurrentValues<K,V> |
Thread-safe
Map whose values are kept alive by soft/weak References. |
| MildElements<T> |
NON-thread-safe
Collection of elements kept alive by soft/weak References. |
| MildElements.Soft<T> |
Soft
MildElements.Indexable element. |
| MildElements.Weak<T> |
Weak
MildElements.Indexable element. |
| MildKeys<K,V> |
NON-thread-safe
Map whose keys are kept alive by soft/weak References. |
| MildKeys.Soft<T> |
Soft key that maintains a constant hash and uses referential equality.
|
| MildKeys.Weak<T> |
Weak key that maintains a constant hash and uses referential equality.
|
| MildValues<K,V> |
NON-thread-safe
Map whose values are kept alive by soft/weak References. |
| MildValues.Soft<K,V> |
Soft value with an
MildValues.InverseMapping back to its key. |
| MildValues.Weak<K,V> |
Weak value with an
MildValues.InverseMapping back to its key. |
| PrioritySource |
Implementation of @
Priority that can also act as an @AnnotatedSource. |
| RankedBindings<T> |
Ordered sequence of
Bindings of a given type; subscribes to BindingPublishers on demand. |
| RankedSequence<T> |
Ordered
List that arranges elements by descending rank; supports concurrent iteration and modification. |
| RankedSequence.Content |
Represents an immutable snapshot of ranked elements.
|
| Soft |
Utility methods for dealing with
SoftReference collections. |
| Sources |
Utility methods for dealing with annotated sources.
|
| TypeArguments |
Utility methods for dealing with generic type arguments.
|
| WatchedBeans<Q extends java.lang.annotation.Annotation,T,W> |
Provides dynamic
BeanEntry notifications by tracking qualified Bindings. |
| Weak |
Utility methods for dealing with
WeakReference collections. |
| Enum | Description |
|---|---|
| QualifyingStrategy |
Enumerates the different strategies for qualifying
Bindings against requirement Keys. |
| Annotation Type | Description |
|---|---|
| TypeArguments.Implicit |
Qualifier of bindings that should be treated as implicit. |
The BeanLocator lets you lookup and keep watch for bean implementations;
it does this by processing binding information from one or more BindingPublishers, such as injectors.
You can add or remove BindingPublishers using the MutableBeanLocator
view; any existing watchers or returned collections are updated to reflect the latest binding information.
DefaultBeanLocator will automatically add any injectors it's bound in by virtue
of an injected setter. This makes it easy to share across multiple injectors with a simple instance binding:
Module locatorModule = new AbstractModule() {
private final DefaultBeanLocator locator = new DefaultBeanLocator();
@Override protected void configure() {
bind( DefaultBeanLocator.class ).toInstance( locator );
}
};
Injector injectorA = Guice.createInjector( new WireModule( locatorModule, spaceModuleA ) ); // adds injectorA to locator
Injector injectorB = Guice.createInjector( new WireModule( locatorModule, spaceModuleB ) ); // adds injectorB to locator
If you want to use a DefaultBeanLocator in a given injector, but don't want that injector
added automatically, wrap the locator inside a provider to hide the injected setter from Guice:
bind( DefaultBeanLocator.class ).toProvider( Providers.of( locator ) );By default all bindings in an injector are separated into two partitions (default vs non-default) and ranked according to their sequence number. This is so bindings from multiple injectors can be interleaved to keep default components prioritized before non-default, while still maintaining an overall ordering between injectors. To override the default bind your own
RankingFunction:
bind( RankingFunction.class ).to( MyRankingFunction.class );