Uses of Class
com.google.inject.Key
Packages that use Key
Package
Description
Google Guice (pronounced "juice") is an ultra-lightweight dependency injection framework.
Interfaces which make up
Binder
's expression language.Guice (sounds like "juice")
Extension for binding multiple instances in a collection; this extension requires
guice-multibindings.jar
.Guice service provider interface
-
Uses of Key in com.google.inject
Methods in com.google.inject that return KeyModifier and TypeMethodDescriptionstatic <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> 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
<?> 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.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> Returns a new key of the specified type with the same annotation as this key.Key
<?> Returns a new key of the specified type with the same annotation as this key.Key.withAnnotation
(Annotation annotation) Returns a new key of the same type with the specified annotation.Key.withAnnotation
(Class<? extends Annotation> annotationType) Returns a new key of the same type with the specified annotation.Key.withoutAttributes()
Returns this key without annotation attributes, i.e.Methods in com.google.inject that return types with arguments of type KeyModifier and TypeMethodDescriptionInjector.getAllBindings()
Returns a snapshot of this injector's bindings, both explicit and just-in-time.Injector.getBindings()
Returns this injector's explicit bindings.Methods in com.google.inject with parameters of type KeyModifier and TypeMethodDescriptionprotected <T> LinkedBindingBuilder
<T> <T> LinkedBindingBuilder
<T> See the EDSL examples atBinder
.protected final <T> LinkedBindingBuilder
<T> void
Makes the binding forkey
available to the enclosing environmentprotected final <T> void
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 final <T> Provider
<T> PrivateModule.getProvider
(Key<T> key) protected void
AbstractModule.requireBinding
(Key<?> key) Adds a dependency from this module tokey
.protected final void
PrivateModule.requireBinding
(Key<?> key) Instructs Guice to require a binding to the given key.<T> Provider
<T> Scopes a provider. -
Uses of Key in com.google.inject.binder
Methods in com.google.inject.binder with parameters of type KeyModifier and TypeMethodDescriptionSee the EDSL examples atBinder
.LinkedBindingBuilder.toProvider
(Key<? extends javax.inject.Provider<? extends T>> providerKey) See the EDSL examples atBinder
. -
Uses of Key in com.google.inject.internal
Fields in com.google.inject.internal declared as KeyMethods in com.google.inject.internal that return KeyModifier and TypeMethodDescriptionstatic <T> Key
<T> MoreTypes.canonicalizeKey
(Key<T> key) Returns a key that doesn't hold any references to parent classes.static Key
<?> Annotations.getKey
(TypeLiteral<?> type, Member member, Annotation[] annotations, Errors errors) Gets a key for the given type, member and annotations.BindingImpl.getKey()
Key
<?> ExposureBuilder.getKey()
ProviderMethod.getKey()
Methods in com.google.inject.internal that return types with arguments of type KeyMethods in com.google.inject.internal with parameters of type KeyModifier and TypeMethodDescriptionErrors.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.childBindingAlreadySet
(Key<?> key, Set<Object> sources) <K,
V> Errors Errors.duplicateMapKey
(Key<Map<K, V>> mapKey, com.google.common.collect.Multimap<K, Binding<V>> duplicates) Errors.errorCheckingDuplicateBinding
(Key<?> key, Object source, Throwable t) Errors.exposedButNotBound
(Key<?> key) PrivateElementsImpl.getExposedSource
(Key<?> key) Errors.jitBindingAlreadySet
(Key<?> key) Errors.jitDisabled
(Key<?> key) static InternalProvisionException
InternalProvisionException.jitDisabled
(Key<?> key) Errors.jitDisabledInParent
(Key<?> key) Errors.missingImplementation
(Key<?> key) We use a fairly generic error message here.static String
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.Errors.recursiveBinding
(Key<?> key, Key<?> linkedKey) <T> Provider
<T> 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 initializationBindingBuilder.toProvider
(Key<? extends javax.inject.Provider<? extends T>> providerKey) protected BindingImpl
<T> Constructors in com.google.inject.internal with parameters of type Key -
Uses of Key in com.google.inject.multibindings
Methods in com.google.inject.multibindings that return KeyModifier and TypeMethodDescriptionOptionalBinderBinding.getKey()
Returns theKey
for this binding.MapBinderBinding.getMapKey()
Returns theKey
for the map.MultibinderBinding.getSetKey()
Returns the key for the set.Methods in com.google.inject.multibindings that return types with arguments of type KeyModifier and TypeMethodDescriptionOptionalBinderBinding.getAlternateKeys()
Returns the keys of other bindings that represent this OptionalBinder.MapBinderBinding.getAlternateMapKeys()
Returns the keys of other bindings that represent this map.MultibinderBinding.getAlternateSetKeys()
Returns the keys of other bindings that represent this set.Methods in com.google.inject.multibindings with parameters of type KeyModifier and TypeMethodDescriptionstatic <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.spi
Methods in com.google.inject.spi that return KeyModifier and TypeMethodDescriptionDependency.getKey()
Returns the key to the binding that satisfies this dependency.ProviderLookup.getKey()
ProvidesMethodBinding.getKey()
Returns the key of the binding.LinkedKeyBinding.getLinkedKey()
Returns the linked key used to resolve injections.Key
<?> ProviderBinding.getProvidedKey()
Returns the key whose binding is used toprovide instances
.ProviderKeyBinding.getProviderKey()
Returns the key used to resolve the provider's binding.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.Methods in com.google.inject.spi that return types with arguments of type KeyModifier and TypeMethodDescriptionPrivateElements.getExposedKeys()
Returns the unique exposed keys for these private elements.Methods in com.google.inject.spi with parameters of type KeyModifier and TypeMethodDescriptionstatic <T> Dependency
<T> Returns a new dependency that is not attached to an injection point.PrivateElements.getExposedSource
(Key<?> key) Returns an arbitrary object containing information about the "place" where this key was exposed.BindingSourceRestriction.getMissingImplementationSuggestion
(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.abstract <T> Key
<T> ModuleAnnotatedMethodScanner.prepareMethod
(Binder binder, Annotation annotation, Key<T> key, InjectionPoint injectionPoint) Prepares a method for binding.Constructors in com.google.inject.spi with parameters of type Key