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 "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 |
AbstractModule.bindListener(Matcher<? super Binding<?>> bindingMatcher,
ProvisionListener... listener) |
void |
Binder.bindListener(Matcher<? super Binding<?>> bindingMatcher,
ProvisionListener... listeners)
Registers listeners for provisioned objects.
|
protected void |
PrivateModule.bindListener(Matcher<? super Binding<?>> bindingMatcher,
ProvisionListener... listeners) |
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<Node> |
DefaultNodeCreator.NodeVisitor.visitOther(Binding<?> binding) |
java.util.Collection<Key<?>> |
TransitiveDependencyVisitor.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> |
DefaultNodeCreator.getNodes(java.lang.Iterable<Binding<?>> bindings) |
java.lang.Iterable<Node> |
NodeCreator.getNodes(java.lang.Iterable<Binding<?>> bindings)
Returns nodes for the given dependency graph.
|
Modifier and Type | Class and Description |
---|---|
class |
BindingImpl<T> |
(package private) class |
ConstructorBindingImpl<T> |
(package private) class |
ExposedBindingImpl<T> |
private static class |
InjectorImpl.ConvertedConstantBindingImpl<T> |
private static class |
InjectorImpl.SyntheticProviderBindingImpl<T>
A framework-created JIT Provider
|
(package private) class |
InstanceBindingImpl<T> |
(package private) class |
InternalProviderInstanceBindingImpl<T>
A
ProviderInstanceBindingImpl for implementing 'native' guice extensions. |
(package private) class |
LinkedBindingImpl<T> |
(package private) class |
LinkedProviderBindingImpl<T> |
(package private) class |
ProviderInstanceBindingImpl<T> |
(package private) class |
UntargettedBindingImpl<T> |
Modifier and Type | Field and Description |
---|---|
private Binding<?> |
BindingAlreadySetError.binding |
(package private) Binding<T> |
DuplicateElementError.Element.binding |
(package private) Binding<?> |
ProvisionListenerCallbackStore.KeyBinding.binding |
private Binding<T> |
ProvisionListenerStackCallback.binding |
private Binding<V>[] |
RealMapBinder.MultimapBinder.RealMultimapProvider.PerKeyData.bindings |
private Binding<?> |
BindingAlreadySetError.original |
(package private) Binding<java.lang.String> |
InjectorImpl.ConvertedConstantBindingImpl.originalBinding |
Modifier and Type | Field and Description |
---|---|
(package private) java.util.List<Binding<T>> |
RealMultibinder.RealMultibinderProvider.bindings |
private com.google.common.collect.ImmutableList<Binding<T>> |
RealMultibinder.BindingSelection.bindings |
private com.google.common.collect.Multimap<K,Binding<V>> |
DuplicateMapKeyError.duplicates |
private com.google.common.collect.ImmutableList<java.util.Map.Entry<K,Binding<V>>> |
RealMapBinder.BindingSelection.entries |
private java.util.Map<Key<?>,Binding<?>> |
InjectorBindingData.explicitBindings |
private java.util.Map<Key<?>,Binding<?>> |
InjectorBindingData.explicitBindingsMutable |
private com.google.common.collect.ListMultimap<TypeLiteral<?>,Binding<?>> |
InjectorBindingData.indexedExplicitBindings |
private com.google.common.collect.ImmutableMap<K,Binding<V>> |
RealMapBinder.BindingSelection.mapBindings
These are built during initialization and used by all factories to actually provide the
relevant maps.
|
private com.google.common.collect.ImmutableMap<K,java.util.Set<Binding<V>>> |
RealMapBinder.BindingSelection.multimapBindings |
Modifier and Type | Method and Description |
---|---|
Binding<?> |
RealOptionalBinder.JavaOptionalProvider.getActualBinding() |
Binding<?> |
RealOptionalBinder.RealOptionalKeyProvider.getActualBinding() |
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) |
Binding<?> |
RealOptionalBinder.JavaOptionalProvider.getDefaultBinding() |
Binding<?> |
RealOptionalBinder.RealOptionalKeyProvider.getDefaultBinding() |
<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) |
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() |
(package private) com.google.common.collect.ImmutableList<Binding<T>> |
RealMultibinder.BindingSelection.getBindings() |
java.util.List<Binding<?>> |
RealMultibinder.ExtensionRealMultibinderProvider.getElements() |
(package private) java.util.List<Binding<?>> |
RealMultibinder.BindingSelection.getElements() |
private com.google.common.collect.ImmutableList<java.util.Map.Entry<K,Binding<V>>> |
RealMapBinder.BindingSelection.getEntries() |
java.util.List<java.util.Map.Entry<?,Binding<?>>> |
RealMapBinder.ExtensionRealMapProvider.getEntries() |
java.util.List<java.util.Map.Entry<?,Binding<?>>> |
RealMapBinder.ExtensionRealMapProvider.getEntries(java.lang.Iterable<? extends Element> elements) |
java.util.Map<Key<?>,Binding<?>> |
InjectorBindingData.getExplicitBindingsThisLevel() |
com.google.common.collect.ListMultimap<TypeLiteral<?>,Binding<?>> |
InjectorBindingData.getIndexedExplicitBindings() |
private com.google.common.collect.ImmutableMap<K,Binding<V>> |
RealMapBinder.BindingSelection.getMapBindings() |
private com.google.common.collect.ImmutableMap<K,java.util.Set<Binding<V>>> |
RealMapBinder.BindingSelection.getMultimapBindings() |
Modifier and Type | Method and Description |
---|---|
(package private) Errors |
Errors.bindingAlreadySet(Binding<?> binding,
Binding<?> original) |
(package private) Errors |
Errors.bindingAlreadySet(Binding<?> binding,
Binding<?> original) |
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.SyntheticProviderBindingImpl.createInternalFactory(Binding<T> providedBinding) |
private static <K,V> InternalProvisionException |
RealMapBinder.createNullValueException(K key,
Binding<V> binding) |
<T> ProvisionListenerStackCallback<T> |
ProvisionListenerCallbackStore.get(Binding<T> binding)
Returns a new
ProvisionListenerStackCallback for the key or null if there are
no listeners |
(package private) boolean |
Indexer.isIndexable(Binding<?> 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.
|
private java.lang.Object |
Indexer.scope(Binding<?> binding) |
<T> java.lang.Boolean |
BindingProcessor.visit(Binding<T> command) |
<T> java.lang.Boolean |
UntargettedBindingProcessor.visit(Binding<T> binding) |
Modifier and Type | Method and Description |
---|---|
<K,V> Errors |
Errors.duplicateMapKey(Key<java.util.Map<K,V>> mapKey,
com.google.common.collect.Multimap<K,Binding<V>> duplicates) |
private static <K,V> java.lang.String |
DuplicateMapKeyError.getDuplicateKeysMessage(Key<java.util.Map<K,V>> mapKey,
com.google.common.collect.Multimap<K,Binding<V>> duplicates) |
(package private) static <T> com.google.common.collect.ImmutableMultimap<T,DuplicateElementError.Element<T>> |
DuplicateElementError.indexElements(java.util.List<Binding<T>> bindings,
T[] values) |
private static <K,V> void |
RealMapBinder.BindingSelection.reportDuplicateKeysError(Key<java.util.Map<K,V>> mapKey,
com.google.common.collect.Multimap<K,Binding<V>> duplicates,
Errors errors) |
Constructor and Description |
---|
BindingAlreadySetError(Binding<?> binding,
Binding<?> original,
java.util.List<java.lang.Object> sources) |
BindingAlreadySetError(Binding<?> binding,
Binding<?> original,
java.util.List<java.lang.Object> sources) |
ConvertedConstantBindingImpl(InjectorImpl injector,
Key<T> key,
T value,
Binding<java.lang.String> originalBinding,
TypeConverterBinding typeConverterBinding) |
Element(T value,
Binding<T> binding) |
IndexedBinding(Binding<?> binding,
Indexer.BindingType type,
java.lang.Object scope,
java.lang.Object extraEquality) |
KeyBinding(Key<?> key,
Binding<?> binding) |
PerKeyData(K key,
Binding<V>[] bindings,
SingleParameterInjector<V>[] injectors) |
ProvisionListenerStackCallback(Binding<T> binding,
java.util.List<ProvisionListener> listeners) |
SyntheticProviderBindingImpl(InjectorImpl injector,
Key<Provider<T>> key,
Binding<T> providedBinding) |
Constructor and Description |
---|
DuplicateElementError(Key<java.util.Set<T>> setKey,
java.util.List<Binding<T>> bindings,
T[] values,
java.util.List<java.lang.Object> sources) |
DuplicateMapKeyError(Key<java.util.Map<K,V>> mapKey,
com.google.common.collect.Multimap<K,Binding<V>> duplicates,
java.util.List<java.lang.Object> sources) |
Modifier and Type | Method and Description |
---|---|
Binding<?> |
OptionalBinderBinding.getActualBinding()
Returns the actual binding (set by
OptionalBinder.setBinding() ) or null if not set. |
Binding<?> |
OptionalBinderBinding.getDefaultBinding()
Returns the default binding (set by
OptionalBinder.setDefault() ) if one exists or null if
no default binding is set. |
Modifier and Type | Method and Description |
---|---|
java.util.List<Binding<?>> |
MultibinderBinding.getElements()
Returns all bindings that make up the set.
|
java.util.List<java.util.Map.Entry<?,Binding<?>>> |
MapBinderBinding.getEntries()
Returns all entries in the Map.
|
java.util.List<java.util.Map.Entry<?,Binding<?>>> |
MapBinderBinding.getEntries(java.lang.Iterable<? extends Element> elements)
Similar to
MapBinderBinding.getEntries() , but can be used on a MapBinderBinding retrieved from Elements.getElements(com.google.inject.Module...) . |
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 |
---|---|
private static java.util.Optional<Message> |
BindingSourceRestriction.check(Binding<?> binding) |
<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) |