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 class
private static final class
A helper object that implements the core logic for deciding what the implementation of the binding will be.(package private) static @interface
(package private) static class
private static final class
Provides the binding for java.util.Optional. private static final class
Provides the binding for java.util.Optional<Provider>. private static final class
Provides the binding for T, conditionally installed by calling setBinding/setDefault.private static class
A base class for ProviderWithDependencies that need equality based on a specific object.private static final class
Provides the binding for Optional. private static final class
Provides the binding for Optional<Provider>. (package private) static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Binder
private final RealOptionalBinder.BindingSelection<T>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addDirectTypeBinding
(Binder binder) Adds a binding for T.void
Contributes bindings and other configurations for this module tobinder
.boolean
Returns the key to use for the actual binding, overrides the default if set.Returns the key to use for the default binding.int
hashCode()
(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
T
will 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
T
will be made available. -
setBinding
-
configure
Description copied from interface:Module
Contributes 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 methods
are discovered. -
equals
-
hashCode
public int hashCode()
-