Package com.google.inject.internal
Class RealOptionalBinder<T>
java.lang.Object
com.google.inject.internal.RealOptionalBinder<T>
- All Implemented Interfaces:
Module
The actual OptionalBinder plays several roles. It implements Module to hide that fact from the
public API, and installs the various bindings that are exposed to the user.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static @interface(package private) static class(package private) static classprivate static final classA helper object that implements the core logic for deciding what the implementation of the binding will be.(package private) static @interface(package private) static classprivate static final classProvides the binding for java.util.Optional. private static final classProvides the binding for java.util.Optionalinvalid input: '<'Provider>. private static final classProvides the binding for T, conditionally installed by calling setBinding/setDefault.private static classA base class for ProviderWithDependencies that need equality based on a specific object.private static final classProvides the binding for Optional. private static final classProvides the binding for Optionalinvalid input: '<'Provider>. (package private) static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Binderprivate final RealOptionalBinder.BindingSelection<T> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddDirectTypeBinding(Binder binder) Adds a binding for T.voidContributes bindings and other configurations for this module tobinder.booleanReturns the key to use for the actual binding, overrides the default if set.Returns the key to use for the default binding.inthashCode()(package private) static <T> TypeLiteral<Optional<T>> javaOptionalOf(TypeLiteral<T> type) (package private) static <T> TypeLiteral<Optional<javax.inject.Provider<T>>> javaOptionalOfJavaxProvider(TypeLiteral<T> type) (package private) static <T> TypeLiteral<Optional<Provider<T>>> javaOptionalOfProvider(TypeLiteral<T> type) static <T> RealOptionalBinder<T> newRealOptionalBinder(Binder binder, Key<T> type) (package private) static <T> TypeLiteral<com.google.common.base.Optional<T>> optionalOf(TypeLiteral<T> type) (package private) static <T> TypeLiteral<com.google.common.base.Optional<javax.inject.Provider<T>>> optionalOfJavaxProvider(TypeLiteral<T> type) (package private) static <T> TypeLiteral<com.google.common.base.Optional<Provider<T>>> optionalOfProvider(TypeLiteral<T> type) providerOf(Key<T> key)
-
Field Details
-
bindingSelection
-
binder
-
-
Constructor Details
-
RealOptionalBinder
-
-
Method Details
-
newRealOptionalBinder
-
optionalOf
-
javaOptionalOf
-
optionalOfJavaxProvider
static <T> TypeLiteral<com.google.common.base.Optional<javax.inject.Provider<T>>> optionalOfJavaxProvider(TypeLiteral<T> type) -
javaOptionalOfJavaxProvider
static <T> TypeLiteral<Optional<javax.inject.Provider<T>>> javaOptionalOfJavaxProvider(TypeLiteral<T> type) -
optionalOfProvider
static <T> TypeLiteral<com.google.common.base.Optional<Provider<T>>> optionalOfProvider(TypeLiteral<T> type) -
javaOptionalOfProvider
-
providerOf
-
addDirectTypeBinding
Adds a binding for T. Multiple calls to this are safe, and will be collapsed as duplicate bindings. -
getKeyForDefaultBinding
Returns the key to use for the default binding.As a side effect this installs support for the 'direct type', so a binding for
Twill be made available. -
setDefault
-
getKeyForActualBinding
Returns the key to use for the actual binding, overrides the default if set.As a side effect this installs support for the 'direct type', so a binding for
Twill be made available. -
setBinding
-
configure
Description copied from interface:ModuleContributes bindings and other configurations for this module tobinder.Do not invoke this method directly to install submodules. Instead use
Binder.install(Module), which ensures thatprovider methodsare discovered. -
equals
-
hashCode
public int hashCode()
-