Package | Description |
---|---|
com.google.inject |
Google Guice (pronounced "juice") is an ultra-lightweight dependency injection framework.
|
com.google.inject.binder |
Interfaces which make up
Binder 's expression language. |
com.google.inject.internal |
Guice (sounds like "juice")
|
com.google.inject.multibindings |
Extension for binding multiple instances in a collection; this extension requires
guice-multibindings.jar . |
com.google.inject.spi |
Guice service provider interface
|
Modifier and Type | Method and Description |
---|---|
static <T> Key<T> |
Key.get(Class<T> type)
Gets a key for an injection type.
|
static <T> Key<T> |
Key.get(Class<T> type,
Annotation annotation)
Gets a key for an injection type and an annotation.
|
static <T> Key<T> |
Key.get(Class<T> type,
Class<? extends Annotation> annotationType)
Gets a key for an injection type and an annotation type.
|
static Key<?> |
Key.get(Type type)
Gets a key for an injection type.
|
static Key<?> |
Key.get(Type type,
Annotation annotation)
Gets a key for an injection type and an annotation.
|
static Key<?> |
Key.get(Type type,
Class<? extends Annotation> annotationType)
Gets a key for an injection type and an annotation type.
|
static <T> Key<T> |
Key.get(TypeLiteral<T> typeLiteral)
Gets a key for an injection type.
|
static <T> Key<T> |
Key.get(TypeLiteral<T> typeLiteral,
Annotation annotation)
Gets a key for an injection type and an annotation.
|
static <T> Key<T> |
Key.get(TypeLiteral<T> typeLiteral,
Class<? extends Annotation> annotationType)
Gets a key for an injection type and an annotation type.
|
Key<T> |
Binding.getKey()
Returns the key for this binding.
|
<T> Key<T> |
Key.ofType(Class<T> type)
Returns a new key of the specified type with the same annotation as this key.
|
Key<?> |
Key.ofType(Type type)
Returns a new key of the specified type with the same annotation as this key.
|
<T> Key<T> |
Key.ofType(TypeLiteral<T> type)
Returns a new key of the specified type with the same annotation as this key.
|
Key<T> |
Key.withoutAttributes()
Returns this key without annotation attributes, i.e.
|
Modifier and Type | Method and Description |
---|---|
Map<Key<?>,Binding<?>> |
Injector.getAllBindings()
Returns a snapshot of this injector's bindings, both explicit and
just-in-time.
|
Map<Key<?>,Binding<?>> |
Injector.getBindings()
Returns this injector's explicit bindings.
|
Modifier and Type | Method and Description |
---|---|
protected <T> LinkedBindingBuilder<T> |
AbstractModule.bind(Key<T> key) |
protected <T> LinkedBindingBuilder<T> |
PrivateModule.bind(Key<T> key) |
<T> LinkedBindingBuilder<T> |
Binder.bind(Key<T> key)
See the EDSL examples at
Binder . |
void |
PrivateBinder.expose(Key<?> key)
Makes the binding for
key available to the enclosing environment |
protected <T> void |
PrivateModule.expose(Key<T> key)
Makes the binding for
key available to other modules and the injector. |
<T> Binding<T> |
Injector.getBinding(Key<T> key)
Returns the binding for the given injection key.
|
<T> Binding<T> |
Injector.getExistingBinding(Key<T> key)
Returns the binding if it already exists, or null if does not exist.
|
<T> T |
Injector.getInstance(Key<T> key)
Returns the appropriate instance for the given injection key; equivalent to
getProvider(key).get() . |
<T> Provider<T> |
Injector.getProvider(Key<T> key)
Returns the provider used to obtain instances for the given injection key.
|
protected <T> Provider<T> |
AbstractModule.getProvider(Key<T> key) |
protected <T> Provider<T> |
PrivateModule.getProvider(Key<T> key) |
<T> Provider<T> |
Binder.getProvider(Key<T> key)
Returns the provider used to obtain instances for the given injection key.
|
protected void |
AbstractModule.requireBinding(Key<?> key)
Adds a dependency from this module to
key . |
protected void |
PrivateModule.requireBinding(Key<?> key)
Instructs Guice to require a binding to the given key.
|
<T> Provider<T> |
Scope.scope(Key<T> key,
Provider<T> unscoped)
Scopes a provider.
|
Modifier and Type | Method and Description |
---|---|
ScopedBindingBuilder |
LinkedBindingBuilder.to(Key<? extends T> targetKey)
See the EDSL examples at
Binder . |
ScopedBindingBuilder |
LinkedBindingBuilder.toProvider(Key<? extends javax.inject.Provider<? extends T>> providerKey)
See the EDSL examples at
Binder . |
Modifier and Type | Field and Description |
---|---|
protected static Key<?> |
AbstractBindingBuilder.NULL_KEY |
Modifier and Type | Method and Description |
---|---|
static <T> Key<T> |
MoreTypes.canonicalizeKey(Key<T> key)
Returns a key that doesn't hold any references to parent classes.
|
Key<?> |
ExposureBuilder.getKey() |
Key<T> |
ProviderMethod.getKey() |
Key<T> |
BindingImpl.getKey() |
static Key<?> |
Annotations.getKey(TypeLiteral<?> type,
Member member,
Annotation[] annotations,
Errors errors)
Gets a key for the given type, member and annotations.
|
Key<? extends T> |
LinkedBindingImpl.getLinkedKey() |
Modifier and Type | Method and Description |
---|---|
Set<Key<?>> |
PrivateElementsImpl.getExposedKeys() |
Modifier and Type | Method and Description |
---|---|
Errors |
Errors.bindingAlreadySet(Key<?> key,
Object source) |
static <T> Key<T> |
MoreTypes.canonicalizeKey(Key<T> key)
Returns a key that doesn't hold any references to parent classes.
|
Errors |
Errors.childBindingAlreadySet(Key<?> key,
Set<Object> sources) |
Errors |
Errors.errorCheckingDuplicateBinding(Key<?> key,
Object source,
Throwable t) |
Errors |
Errors.exposedButNotBound(Key<?> key) |
Object |
PrivateElementsImpl.getExposedSource(Key<?> key) |
Errors |
Errors.jitBindingAlreadySet(Key<?> key) |
static InternalProvisionException |
InternalProvisionException.jitDisabled(Key<?> key) |
Errors |
Errors.jitDisabled(Key<?> key) |
Errors |
Errors.jitDisabledInParent(Key<?> key) |
Errors |
Errors.missingImplementation(Key key)
We use a fairly generic error message here.
|
static String |
Annotations.nameOf(Key<?> key)
Returns the name the binding should use.
|
static <T> RealOptionalBinder<T> |
RealOptionalBinder.newRealOptionalBinder(Binder binder,
Key<T> type) |
static <T> RealMultibinder<T> |
RealMultibinder.newRealSetBinder(Binder binder,
Key<T> key)
Implementation of newSetBinder.
|
<T> Provider<T> |
SingletonScope.scope(Key<T> key,
Provider<T> creator)
Provides singleton scope with the following properties: - creates no more than one instance per
Key as a creator is used no more than once, - result is cached and returned quickly on
subsequent calls, - exception in a creator is not treated as instance creation and is not
cached, - creates singletons in parallel whenever possible, - waits for dependent singletons to
be created even across threads and when dependencies are shared as long as no circular
dependencies are detected, - returns circular proxy only when circular dependencies are
detected, - aside from that, blocking synchronization is only used for proxy creation and
initialization,
|
BindingBuilder<T> |
BindingBuilder.to(Key<? extends T> linkedKey) |
BindingBuilder<T> |
BindingBuilder.toProvider(Key<? extends javax.inject.Provider<? extends T>> providerKey) |
BindingImpl<T> |
LinkedBindingImpl.withKey(Key<T> key) |
protected BindingImpl<T> |
BindingImpl.withKey(Key<T> key) |
Constructor and Description |
---|
AbstractBindingBuilder(Binder binder,
List<Element> elements,
Object source,
Key<T> key) |
BindingBuilder(Binder binder,
List<Element> elements,
Object source,
Key<T> key) |
BindingImpl(com.google.inject.internal.InjectorImpl injector,
Key<T> key,
Object source,
com.google.inject.internal.InternalFactory<? extends T> internalFactory,
Scoping scoping) |
BindingImpl(Object source,
Key<T> key,
Scoping scoping) |
ExposedBindingImpl(com.google.inject.internal.InjectorImpl injector,
Object source,
Key<T> key,
com.google.inject.internal.InternalFactory<T> factory,
PrivateElements privateElements) |
ExposureBuilder(Binder binder,
Object source,
Key<T> key) |
LinkedBindingImpl(com.google.inject.internal.InjectorImpl injector,
Key<T> key,
Object source,
com.google.inject.internal.InternalFactory<? extends T> internalFactory,
Scoping scoping,
Key<? extends T> targetKey) |
LinkedBindingImpl(com.google.inject.internal.InjectorImpl injector,
Key<T> key,
Object source,
com.google.inject.internal.InternalFactory<? extends T> internalFactory,
Scoping scoping,
Key<? extends T> targetKey) |
LinkedBindingImpl(Object source,
Key<T> key,
Scoping scoping,
Key<? extends T> targetKey) |
LinkedBindingImpl(Object source,
Key<T> key,
Scoping scoping,
Key<? extends T> targetKey) |
Modifier and Type | Method and Description |
---|---|
Key<T> |
OptionalBinderBinding.getKey()
Returns the
Key for this binding. |
Key<T> |
MapBinderBinding.getMapKey()
Returns the
Key for the map. |
Key<T> |
MultibinderBinding.getSetKey()
Returns the key for the set.
|
Modifier and Type | Method and Description |
---|---|
static <T> OptionalBinder<T> |
OptionalBinder.newOptionalBinder(Binder binder,
Key<T> type) |
static <T> Multibinder<T> |
Multibinder.newSetBinder(Binder binder,
Key<T> key)
Returns a new multibinder that collects instances of the key's type in a
Set that is
itself bound with the annotation (if any) of the key. |
Modifier and Type | Method and Description |
---|---|
Key<T> |
Dependency.getKey()
Returns the key to the binding that satisfies this dependency.
|
Key<T> |
ProvidesMethodBinding.getKey()
Returns the key of the binding.
|
Key<T> |
ProviderLookup.getKey() |
Key<? extends T> |
LinkedKeyBinding.getLinkedKey()
Returns the linked key used to resolve injections.
|
Key<?> |
ProviderBinding.getProvidedKey()
Returns the key whose binding is used to
provide instances . |
Key<? extends javax.inject.Provider<? extends T>> |
ProviderKeyBinding.getProviderKey()
Returns the key used to resolve the provider's binding.
|
Key<String> |
ConvertedConstantBinding.getSourceKey()
Returns the key for the source binding.
|
abstract <T> Key<T> |
ModuleAnnotatedMethodScanner.prepareMethod(Binder binder,
Annotation annotation,
Key<T> key,
InjectionPoint injectionPoint)
Prepares a method for binding.
|
Modifier and Type | Method and Description |
---|---|
Set<Key<?>> |
PrivateElements.getExposedKeys()
Returns the unique exposed keys for these private elements.
|
Modifier and Type | Method and Description |
---|---|
static <T> Dependency<T> |
Dependency.get(Key<T> key)
Returns a new dependency that is not attached to an injection point.
|
Object |
PrivateElements.getExposedSource(Key<?> key)
Returns an arbitrary object containing information about the "place" where this key was
exposed.
|
<T> Provider<T> |
TypeEncounter.getProvider(Key<T> key)
Returns the provider used to obtain instances for the given injection key.
|
abstract <T> Key<T> |
ModuleAnnotatedMethodScanner.prepareMethod(Binder binder,
Annotation annotation,
Key<T> key,
InjectionPoint injectionPoint)
Prepares a method for binding.
|
Constructor and Description |
---|
ProviderLookup(Object source,
Key<T> key) |
Copyright © 2006–2018 Google, Inc.. All rights reserved.