Package | Description |
---|---|
com.google.inject |
Google Guice (pronounced "juice") is an ultra-lightweight dependency
injection framework.
|
com.google.inject.assistedinject |
Extension for combining factory interfaces with injection; this extension requires
guice-assistedinject.jar . |
com.google.inject.grapher | |
com.google.inject.internal |
Guice (sounds like like "juice")
|
com.google.inject.multibindings |
Extension for binding multiple instances in a collection; this extension requires
guice-multibindings.jar . |
com.google.inject.servlet |
Servlet API scopes, bindings and registration; this extension requires
guice-servlet.jar . |
com.google.inject.spi |
Guice service provider interface
|
com.google.inject.tools.jmx |
JMX integration; this extension requires
guice-jmx.jar . |
com.google.inject.util |
Helper methods for working with Guice.
|
Modifier and Type | Method and Description |
---|---|
<T> Binding<T> |
Injector.getBinding(java.lang.Class<T> type)
Returns the binding for the given type.
|
<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.
|
Modifier and Type | Method and Description |
---|---|
<T> java.util.List<Binding<T>> |
Injector.findBindingsByType(TypeLiteral<T> type)
Returns all explicit bindings for
type . |
java.util.Map<Key<?>,Binding<?>> |
Injector.getAllBindings()
Returns a snapshot of this injector's bindings, both explicit and
just-in-time.
|
java.util.Map<Key<?>,Binding<?>> |
Injector.getBindings()
Returns this injector's explicit bindings.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
Scopes.isScoped(Binding<?> binding,
Scope scope,
java.lang.Class<? extends java.lang.annotation.Annotation> scopeAnnotation)
Returns true if
binding has the given scope. |
static boolean |
Scopes.isSingleton(Binding<?> binding)
Returns true if
binding is singleton-scoped. |
Modifier and Type | Method and Description |
---|---|
protected void |
PrivateModule.bindListener(Matcher<? super Binding<?>> bindingMatcher,
ProvisionListener... listeners) |
void |
Binder.bindListener(Matcher<? super Binding<?>> bindingMatcher,
ProvisionListener... listeners)
Registers listeners for provisioned objects.
|
protected void |
AbstractModule.bindListener(Matcher<? super Binding<?>> bindingMatcher,
ProvisionListener... listener) |
Modifier and Type | Field and Description |
---|---|
(package private) Binding<?> |
FactoryProvider2.AssistData.cachedBinding
used to perform optimized factory creations.
|
Modifier and Type | Method and Description |
---|---|
Binding<?> |
FactoryProvider2.getBindingFromNewInjector(java.lang.reflect.Method method,
java.lang.Object[] args,
FactoryProvider2.AssistData data)
Creates a child injector that binds the args, and returns the binding for the method's result.
|
Modifier and Type | Method and Description |
---|---|
private <T extends Binding<?> & HasDependencies> |
DefaultEdgeCreator.EdgeVisitor.newDependencyEdges(NodeId nodeId,
T binding)
Returns a dependency edge for each
Dependency in the binding. |
private <T extends Binding<?> & HasDependencies> |
DefaultNodeCreator.NodeVisitor.newInstanceNode(T binding,
java.lang.Object instance)
Returns a new instance node for the given
Binding . |
Modifier and Type | Method and Description |
---|---|
private java.lang.Iterable<Binding<?>> |
AbstractInjectorGrapher.getBindings(Injector injector,
java.util.Set<Key<?>> root)
Returns the bindings for the root keys and their transitive dependencies.
|
Modifier and Type | Method and Description |
---|---|
private ImplementationNode |
DefaultNodeCreator.NodeVisitor.newImplementationNode(Binding<?> binding,
java.util.Collection<java.lang.reflect.Member> members)
Returns a new implementation node for the given binding.
|
private InterfaceNode |
DefaultNodeCreator.NodeVisitor.newInterfaceNode(Binding<?> binding)
Returns a new interface node for the given
Binding . |
java.util.Collection<Edge> |
DefaultEdgeCreator.EdgeVisitor.visitOther(Binding<?> binding) |
java.util.Collection<Key<?>> |
TransitiveDependencyVisitor.visitOther(Binding<?> binding) |
java.util.Collection<Node> |
DefaultNodeCreator.NodeVisitor.visitOther(Binding<?> binding) |
Modifier and Type | Method and Description |
---|---|
java.lang.Iterable<Alias> |
AliasCreator.createAliases(java.lang.Iterable<Binding<?>> bindings)
Returns aliases for the given dependency graph.
|
java.lang.Iterable<Alias> |
ProviderAliasCreator.createAliases(java.lang.Iterable<Binding<?>> bindings) |
java.lang.Iterable<Edge> |
DefaultEdgeCreator.getEdges(java.lang.Iterable<Binding<?>> bindings) |
java.lang.Iterable<Edge> |
EdgeCreator.getEdges(java.lang.Iterable<Binding<?>> bindings)
Returns edges for the given dependency graph.
|
java.lang.Iterable<Node> |
NodeCreator.getNodes(java.lang.Iterable<Binding<?>> bindings)
Returns nodes for the given dependency graph.
|
java.lang.Iterable<Node> |
DefaultNodeCreator.getNodes(java.lang.Iterable<Binding<?>> bindings) |
Modifier and Type | Class and Description |
---|---|
class |
BindingImpl<T> |
(package private) class |
ConstructorBindingImpl<T> |
class |
ExposedBindingImpl<T> |
private static class |
InjectorImpl.ConvertedConstantBindingImpl<T> |
private static class |
InjectorImpl.ProviderBindingImpl<T> |
(package private) class |
InstanceBindingImpl<T> |
class |
LinkedBindingImpl<T> |
(package private) class |
LinkedProviderBindingImpl<T> |
(package private) class |
ProviderInstanceBindingImpl<T> |
private static class |
ProviderMethod.ProviderMethodProviderInstanceBindingImpl<T> |
(package private) class |
UntargettedBindingImpl<T> |
Modifier and Type | Field and Description |
---|---|
private Binding<T> |
ProvisionListenerStackCallback.binding |
(package private) Binding<?> |
ProvisionListenerCallbackStore.KeyBinding.binding |
(package private) Binding<java.lang.String> |
InjectorImpl.ConvertedConstantBindingImpl.originalBinding |
Modifier and Type | Field and Description |
---|---|
private java.util.Map<Key<?>,Binding<?>> |
InheritingState.explicitBindings |
private java.util.Map<Key<?>,Binding<?>> |
InheritingState.explicitBindingsMutable |
(package private) java.util.Map<TypeLiteral<?>,java.util.List<Binding<?>>> |
InjectorImpl.BindingsMultimap.multimap |
Modifier and Type | Method and Description |
---|---|
Binding<T> |
ProvisionListenerStackCallback.Provision.getBinding() |
<T> Binding<T> |
InjectorImpl.getBinding(java.lang.Class<T> type) |
<T> Binding<T> |
InternalInjectorCreator.ToolStageInjector.getBinding(java.lang.Class<T> type) |
<T> Binding<T> |
InternalInjectorCreator.ToolStageInjector.getBinding(Key<T> key) |
<T> Binding<T> |
InternalInjectorCreator.ToolStageInjector.getExistingBinding(Key<T> key) |
Modifier and Type | Method and Description |
---|---|
<T> java.util.List<Binding<T>> |
InjectorImpl.findBindingsByType(TypeLiteral<T> type) |
<T> java.util.List<Binding<T>> |
InternalInjectorCreator.ToolStageInjector.findBindingsByType(TypeLiteral<T> type) |
(package private) <T> java.util.List<Binding<T>> |
InjectorImpl.BindingsMultimap.getAll(TypeLiteral<T> type) |
java.util.Map<Key<?>,Binding<?>> |
InjectorImpl.getAllBindings() |
java.util.Map<Key<?>,Binding<?>> |
InternalInjectorCreator.ToolStageInjector.getAllBindings() |
java.util.Map<Key<?>,Binding<?>> |
InjectorImpl.getBindings() |
java.util.Map<Key<?>,Binding<?>> |
InternalInjectorCreator.ToolStageInjector.getBindings() |
java.util.Map<Key<?>,Binding<?>> |
InheritingState.getExplicitBindingsThisLevel() |
java.util.Map<Key<?>,Binding<?>> |
State.getExplicitBindingsThisLevel()
Returns the explicit bindings at this level only.
|
Modifier and Type | Method and Description |
---|---|
private <T> ProvisionListenerStackCallback<T> |
ProvisionListenerCallbackStore.create(Binding<T> binding)
Creates a new
ProvisionListenerStackCallback with the correct listeners
for the key. |
(package private) static <T> InternalFactory<Provider<T>> |
InjectorImpl.ProviderBindingImpl.createInternalFactory(Binding<T> providedBinding) |
<T> ProvisionListenerStackCallback<T> |
ProvisionListenerCallbackStore.get(Binding<T> binding)
Returns a new
ProvisionListenerStackCallback for the key. |
(package private) <T> void |
InjectorImpl.index(Binding<T> binding) |
(package private) <T> void |
InjectorImpl.BindingsMultimap.put(TypeLiteral<T> type,
Binding<T> binding) |
(package private) boolean |
ProvisionListenerCallbackStore.remove(Binding<?> type)
Purges a key from the cache.
|
private void |
InjectorImpl.removeFailedJitBinding(Binding<?> binding,
InjectionPoint ip)
Cleans up any state that may have been cached when constructing the JIT binding.
|
(package private) <T> Initializable<T> |
Initializer.requestInjection(InjectorImpl injector,
T instance,
Binding<T> binding,
java.lang.Object source,
java.util.Set<InjectionPoint> injectionPoints)
Registers an instance for member injection when that step is performed.
|
<T> java.lang.Boolean |
BindingProcessor.visit(Binding<T> command) |
<T> java.lang.Boolean |
UntargettedBindingProcessor.visit(Binding<T> binding) |
Constructor and Description |
---|
ConvertedConstantBindingImpl(InjectorImpl injector,
Key<T> key,
T value,
Binding<java.lang.String> originalBinding,
TypeConverterBinding typeConverterBinding) |
KeyBinding(Key<?> key,
Binding<?> binding) |
ProviderBindingImpl(InjectorImpl injector,
Key<Provider<T>> key,
Binding<T> providedBinding) |
ProvisionListenerStackCallback(Binding<T> binding,
java.util.List<ProvisionListener> listeners) |
Modifier and Type | Field and Description |
---|---|
private Binding<T> |
OptionalBinder.RealOptionalBinder.actualBinding
the actual binding, for the SPI
|
private Binding<V> |
MapBinder.RealMapBinder.ValueProvider.binding |
private Binding<T> |
OptionalBinder.RealOptionalBinder.defaultBinding
the default binding, for the SPI.
|
Modifier and Type | Field and Description |
---|---|
private com.google.common.collect.ImmutableList<Binding<T>> |
Multibinder.RealMultibinder.bindings |
private com.google.common.collect.ImmutableList<java.util.Map.Entry<K,Binding<V>>> |
MapBinder.RealMapBinder.mapBindings |
Modifier and Type | Method and Description |
---|---|
private Binding<?> |
OptionalBinder.RealOptionalBinder.getActualBinding() |
Binding |
OptionalBinder.RealOptionalBinder.JavaOptionalProvider.getActualBinding() |
Binding<?> |
OptionalBinder.RealOptionalBinder.RealOptionalKeyProvider.getActualBinding() |
Binding<?> |
OptionalBinderBinding.getActualBinding()
Returns the actual binding (set by
OptionalBinder.setBinding() ) or null if not set. |
private Binding<?> |
OptionalBinder.RealOptionalBinder.getDefaultBinding() |
Binding |
OptionalBinder.RealOptionalBinder.JavaOptionalProvider.getDefaultBinding() |
Binding<?> |
OptionalBinder.RealOptionalBinder.RealOptionalKeyProvider.getDefaultBinding() |
Binding<?> |
OptionalBinderBinding.getDefaultBinding()
Returns the default binding (set by
OptionalBinder.setDefault() ) if one exists or null
if no default binding is set. |
Binding<V> |
MapBinder.RealMapBinder.ValueProvider.getValueBinding() |
Modifier and Type | Method and Description |
---|---|
java.util.List<Binding<?>> |
MultibinderBinding.getElements()
Returns all bindings that make up the set.
|
java.util.List<Binding<?>> |
Multibinder.RealMultibinder.getElements() |
java.util.List<java.util.Map.Entry<?,Binding<?>>> |
MapBinderBinding.getEntries()
Returns all entries in the Map.
|
java.util.List<java.util.Map.Entry<?,Binding<?>>> |
MapBinder.RealMapBinder.RealMapProvider.getEntries() |
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
Indexer.isIndexable(Binding<?> binding) |
private static <T> ConfigurationException |
Multibinder.newDuplicateValuesException(java.util.Map<T,Binding<T>> existingBindings,
Binding<T> binding,
T newValue,
Binding<T> duplicateBinding) |
private static <T> ConfigurationException |
Multibinder.newDuplicateValuesException(java.util.Map<T,Binding<T>> existingBindings,
Binding<T> binding,
T newValue,
Binding<T> duplicateBinding) |
private java.lang.Object |
Indexer.scope(Binding<?> binding) |
Modifier and Type | Method and Description |
---|---|
private static <T> ConfigurationException |
Multibinder.newDuplicateValuesException(java.util.Map<T,Binding<T>> existingBindings,
Binding<T> binding,
T newValue,
Binding<T> duplicateBinding) |
Constructor and Description |
---|
IndexedBinding(Binding<?> binding,
Indexer.BindingType type,
java.lang.Object scope,
java.lang.Object extraEquality) |
ValueProvider(Provider<V> delegate,
Binding<V> binding) |
Modifier and Type | Method and Description |
---|---|
static boolean |
ServletScopes.isRequestScoped(Binding<?> binding)
Returns true if
binding is request-scoped. |
Modifier and Type | Interface and Description |
---|---|
interface |
ConstructorBinding<T>
A binding to the constructor of a concrete clss.
|
interface |
ConvertedConstantBinding<T>
A binding created from converting a bound instance to a new type.
|
interface |
ExposedBinding<T>
A binding to a key exposed from an enclosed private environment.
|
interface |
InstanceBinding<T>
A binding to a single instance.
|
interface |
LinkedKeyBinding<T>
A binding to a linked key.
|
interface |
ProviderBinding<T extends Provider<?>>
A binding to a
Provider that delegates to the binding for the provided type. |
interface |
ProviderInstanceBinding<T>
A binding to a provider instance.
|
interface |
ProviderKeyBinding<T>
A binding to a provider key.
|
interface |
UntargettedBinding<T>
An untargetted binding.
|
Modifier and Type | Field and Description |
---|---|
private Matcher<? super Binding<?>> |
ProvisionListenerBinding.bindingMatcher |
Modifier and Type | Method and Description |
---|---|
abstract Binding<T> |
ProvisionListener.ProvisionInvocation.getBinding()
Returns the Binding this is provisioning.
|
Modifier and Type | Method and Description |
---|---|
Matcher<? super Binding<?>> |
ProvisionListenerBinding.getBindingMatcher()
Returns the binding matcher which chooses which bindings the listener should be notified of.
|
Modifier and Type | Method and Description |
---|---|
<T> V |
DefaultElementVisitor.visit(Binding<T> binding) |
<T> V |
ElementVisitor.visit(Binding<T> binding)
Visit a mapping from a key (type and optional annotation) to the strategy for getting
instances of the type.
|
protected V |
DefaultBindingTargetVisitor.visitOther(Binding<? extends T> binding)
Default visit implementation.
|
Modifier and Type | Method and Description |
---|---|
void |
Elements.RecordingBinder.bindListener(Matcher<? super Binding<?>> bindingMatcher,
ProvisionListener... listeners) |
Constructor and Description |
---|
ProvisionListenerBinding(java.lang.Object source,
Matcher<? super Binding<?>> bindingMatcher,
ProvisionListener[] listeners) |
Modifier and Type | Field and Description |
---|---|
(package private) Binding |
ManagedBinding.binding |
Constructor and Description |
---|
ManagedBinding(Binding binding) |
Modifier and Type | Method and Description |
---|---|
private Scope |
Modules.OverrideModule.getScopeInstanceOrNull(Binding<?> binding) |