Uses of Class
com.google.inject.Key
-
Packages that use Key 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 requiresguice-assistedinject.jar
.com.google.inject.binder Interfaces which make upBinder
's expression language.com.google.inject.grapher com.google.inject.multibindings Extension for binding multiple instances in a collection; this extension requiresguice-multibindings.jar
.com.google.inject.servlet Servlet API scopes, bindings and registration; this extension requiresguice-servlet.jar
.com.google.inject.spi Guice service provider interfacecom.google.inject.testing.fieldbinder com.google.inject.throwingproviders Extension for injecting objects that may throw at provision time; this extension requiresguice-throwingproviders.jar
. -
-
Uses of Key in com.google.inject
Methods in com.google.inject that return Key Modifier and Type Method Description 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.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.Key<T>
Binding. getKey()
Returns the key for this binding.<U> Key<U>
Key. ofType(TypeLiteral<U> type)
Returns a new key of the specified type with the same annotation as this key.<U> Key<U>
Key. ofType(Class<U> 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.Key<T>
Key. withAnnotation(Annotation annotation)
Returns a new key of the same type with the specified annotation.Key<T>
Key. withAnnotation(Class<? extends Annotation> annotationType)
Returns a new key of the same type with the specified annotation.Key<T>
Key. withoutAttributes()
Returns this key without annotation attributes, i.e.Methods in com.google.inject that return types with arguments of type Key Modifier and Type Method 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.Methods in com.google.inject with parameters of type Key Modifier and Type Method Description protected <T> LinkedBindingBuilder<T>
AbstractModule. bind(Key<T> key)
<T> LinkedBindingBuilder<T>
Binder. bind(Key<T> key)
See the EDSL examples atBinder
.protected <T> LinkedBindingBuilder<T>
PrivateModule. bind(Key<T> key)
void
PrivateBinder. expose(Key<?> key)
Makes the binding forkey
available to the enclosing environmentprotected <T> void
PrivateModule. expose(Key<T> key)
Makes the binding forkey
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 togetProvider(key).get()
.protected <T> Provider<T>
AbstractModule. getProvider(Key<T> key)
<T> Provider<T>
Binder. getProvider(Key<T> key)
Returns the provider used to obtain instances for the given injection key.<T> Provider<T>
Injector. getProvider(Key<T> key)
Returns the provider used to obtain instances for the given injection key.protected <T> Provider<T>
PrivateModule. getProvider(Key<T> key)
protected void
AbstractModule. requireBinding(Key<?> key)
Adds a dependency from this module tokey
.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. -
Uses of Key in com.google.inject.assistedinject
Methods in com.google.inject.assistedinject that return Key Modifier and Type Method Description Key<T>
AssistedInjectBinding. getKey()
Returns theKey
for the factory binding.Methods in com.google.inject.assistedinject with parameters of type Key Modifier and Type Method Description <F> Module
FactoryModuleBuilder. build(Key<F> factoryInterface)
<T> FactoryModuleBuilder
FactoryModuleBuilder. implement(Key<T> source, TypeLiteral<? extends T> target)
See the factory configuration examples atFactoryModuleBuilder
.<T> FactoryModuleBuilder
FactoryModuleBuilder. implement(Key<T> source, Class<? extends T> target)
See the factory configuration examples atFactoryModuleBuilder
. -
Uses of Key in com.google.inject.binder
Methods in com.google.inject.binder with parameters of type Key Modifier and Type Method Description ScopedBindingBuilder
LinkedBindingBuilder. to(Key<? extends T> targetKey)
See the EDSL examples atBinder
.ScopedBindingBuilder
LinkedBindingBuilder. toProvider(Key<? extends jakarta.inject.Provider<? extends T>> providerKey)
See the EDSL examples atBinder
. -
Uses of Key in com.google.inject.grapher
Methods in com.google.inject.grapher that return Key Modifier and Type Method Description Key<?>
NodeId. getKey()
Methods in com.google.inject.grapher that return types with arguments of type Key Modifier and Type Method Description Set<Key<?>>
DefaultRootKeySetCreator. getRootKeys(Injector injector)
Set<Key<?>>
RootKeySetCreator. getRootKeys(Injector injector)
Returns the set of starting keys to graph.Collection<Key<?>>
TransitiveDependencyVisitor. visit(ConstructorBinding<?> binding)
Collection<Key<?>>
TransitiveDependencyVisitor. visit(ConvertedConstantBinding<?> binding)
Collection<Key<?>>
TransitiveDependencyVisitor. visit(InstanceBinding<?> binding)
Collection<Key<?>>
TransitiveDependencyVisitor. visit(LinkedKeyBinding<?> binding)
Collection<Key<?>>
TransitiveDependencyVisitor. visit(ProviderBinding<?> binding)
Collection<Key<?>>
TransitiveDependencyVisitor. visit(ProviderInstanceBinding<?> binding)
Collection<Key<?>>
TransitiveDependencyVisitor. visit(ProviderKeyBinding<?> binding)
Collection<Key<?>>
TransitiveDependencyVisitor. visitOther(Binding<?> binding)
Methods in com.google.inject.grapher with parameters of type Key Modifier and Type Method Description String
NameFactory. getAnnotationName(Key<?> key)
String
ShortNameFactory. getAnnotationName(Key<?> key)
String
NameFactory. getClassName(Key<?> key)
String
ShortNameFactory. getClassName(Key<?> key)
static NodeId
NodeId. newInstanceId(Key<?> key)
static NodeId
NodeId. newTypeId(Key<?> key)
Method parameters in com.google.inject.grapher with type arguments of type Key Modifier and Type Method Description void
AbstractInjectorGrapher. graph(Injector injector, Set<Key<?>> root)
void
InjectorGrapher. graph(Injector injector, Set<Key<?>> root)
Graphs the guice dependency graph for the given injector using the given starting keys and their transitive dependencies. -
Uses of Key in com.google.inject.multibindings
Methods in com.google.inject.multibindings that return Key Modifier and Type Method Description Key<T>
OptionalBinderBinding. getKey()
Returns theKey
for this binding.Key<T>
MapBinderBinding. getMapKey()
Returns theKey
for the map.Key<T>
MultibinderBinding. getSetKey()
Returns the key for the set.Methods in com.google.inject.multibindings that return types with arguments of type Key Modifier and Type Method Description Set<Key<?>>
OptionalBinderBinding. getAlternateKeys()
Returns the keys of other bindings that represent this OptionalBinder.Set<Key<?>>
MapBinderBinding. getAlternateMapKeys()
Returns the keys of other bindings that represent this map.Set<Key<?>>
MultibinderBinding. getAlternateSetKeys()
Returns the keys of other bindings that represent this set.Methods in com.google.inject.multibindings with parameters of type Key Modifier and Type Method 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 aSet
that is itself bound with the annotation (if any) of the key. -
Uses of Key in com.google.inject.servlet
Methods in com.google.inject.servlet that return Key Modifier and Type Method Description Key<? extends jakarta.servlet.Filter>
LinkedFilterBinding. getLinkedKey()
Returns the key used to lookup the filter instance.Key<? extends jakarta.servlet.http.HttpServlet>
LinkedServletBinding. getLinkedKey()
Returns the key used to lookup the servlet instance.Methods in com.google.inject.servlet with parameters of type Key Modifier and Type Method Description void
ServletModule.FilterKeyBindingBuilder. through(Key<? extends jakarta.servlet.Filter> filterKey)
void
ServletModule.FilterKeyBindingBuilder. through(Key<? extends jakarta.servlet.Filter> filterKey, Map<String,String> initParams)
void
ServletModule.ServletKeyBindingBuilder. with(Key<? extends jakarta.servlet.http.HttpServlet> servletKey)
void
ServletModule.ServletKeyBindingBuilder. with(Key<? extends jakarta.servlet.http.HttpServlet> servletKey, Map<String,String> initParams)
Method parameters in com.google.inject.servlet with type arguments of type Key Modifier and Type Method Description static <T> Callable<T>
ServletScopes. continueRequest(Callable<T> callable, Map<Key<?>,Object> seedMap)
Deprecated.You probably want to usetransferRequest
insteadstatic <T> Callable<T>
ServletScopes. scopeRequest(Callable<T> callable, Map<Key<?>,Object> seedMap)
Scopes the given callable inside a request scope.static RequestScoper
ServletScopes. scopeRequest(Map<Key<?>,Object> seedMap)
Returns an object that will apply request scope to a block of code. -
Uses of Key in com.google.inject.spi
Methods in com.google.inject.spi that return Key Modifier and Type Method Description Key<T>
Dependency. getKey()
Returns the key to the binding that satisfies this dependency.Key<T>
ProviderLookup. getKey()
Key<T>
ProvidesMethodBinding. getKey()
Returns the key of the binding.Key<? extends T>
LinkedKeyBinding. getLinkedKey()
Returns the linked key used to resolve injections.Key<?>
ProviderBinding. getProvidedKey()
Returns the key whose binding is used toprovide instances
.Key<? extends jakarta.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.<T> Key<T>
ModuleAnnotatedMethodScanner. prepareMethod(Binder binder, Annotation annotation, Key<T> key, InjectionPoint injectionPoint)
Deprecated.Prefer overriding the overload that takes `Object moduleInstance` instead.<T> Key<T>
ModuleAnnotatedMethodScanner. prepareMethod(Binder binder, Annotation annotation, Key<T> key, InjectionPoint injectionPoint, Object moduleInstance)
Prepares a method for binding.Methods in com.google.inject.spi that return types with arguments of type Key Modifier and Type Method Description Set<Key<?>>
PrivateElements. getExposedKeys()
Returns the unique exposed keys for these private elements.Methods in com.google.inject.spi with parameters of type Key Modifier and Type Method 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.static Optional<String>
BindingSourceRestriction. getMissingImplementationSuggestion(com.google.inject.internal.GuiceInternal guiceInternal, Key<?> key)
Returns a suggestion for how a restricted binding should be created in case it's missing.<T> Provider<T>
TypeEncounter. getProvider(Key<T> key)
Returns the provider used to obtain instances for the given injection key.<T> Key<T>
ModuleAnnotatedMethodScanner. prepareMethod(Binder binder, Annotation annotation, Key<T> key, InjectionPoint injectionPoint)
Deprecated.Prefer overriding the overload that takes `Object moduleInstance` instead.<T> Key<T>
ModuleAnnotatedMethodScanner. prepareMethod(Binder binder, Annotation annotation, Key<T> key, InjectionPoint injectionPoint, Object moduleInstance)
Prepares a method for binding.Constructors in com.google.inject.spi with parameters of type Key Constructor Description ProviderLookup(Object source, Key<T> key)
-
Uses of Key in com.google.inject.testing.fieldbinder
Methods in com.google.inject.testing.fieldbinder that return Key Modifier and Type Method Description Key<?>
BoundFieldModule.BoundFieldInfo. getBoundKey()
The key this field will bind to. -
Uses of Key in com.google.inject.throwingproviders
Methods in com.google.inject.throwingproviders with parameters of type Key Modifier and Type Method Description ScopedBindingBuilder
ThrowingProviderBinder.SecondaryBinder. to(Key<? extends P> targetKey)
-