The bindings contributed by {@code Module}s define how the {@code Injector} resolves dependencies. A {@link Key} consisting of a type and optional annotation uniquely identifies a binding within an {@code Injector}.
You may bind from a key to:
In addition, a binding may have an associated scope, such as {@link Scopes#SINGLETON}, and singleton bindings may specify eager or lazy initialization.
See the users' guide appendix, "How the Injector resolves injection requests," to better understand binding resolution.
After an {@code Injector} has been created, its bindings may be examined using methods like {@link Injector#getBinding(Key)}, but this read-only {@link Binding} type is not used when creating the bindings.]]>
Contains several default bindings:
Example usage for a binding of type {@code Foo} annotated with {@code @Bar}:
{@code new Key
Example usage for a binding of type {@code Foo} annotated with {@code @Bar}:
{@code new Key
Example usage for a binding of type {@code Foo}:
{@code new Key
{@literal @}Inject public void setService({@literal @}Transactional Service service) { ... }
{@code Key} supports generic types via subclassing just like {@link TypeLiteral}. @author crazybob@google.com (Bob Lee)]]>
{@code TypeLiteral Assumes that type {@code T} implements {@link Object#equals} and
{@link Object#hashCode()} as value (as opposed to identity) comparison.
@author crazybob@google.com (Bob Lee)]]>
> list = new TypeLiteral
>() {};}