Package com.google.inject.internal
Class RealOptionalBinder<T>
- java.lang.Object
-
- com.google.inject.internal.RealOptionalBinder<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static interfaceRealOptionalBinder.Actual(package private) static classRealOptionalBinder.ActualImpl(package private) static classRealOptionalBinder.BaseAnnotationprivate static classRealOptionalBinder.BindingSelection<T>A helper object that implements the core logic for deciding what the implementation of the binding will be.(package private) static interfaceRealOptionalBinder.Default(package private) static classRealOptionalBinder.DefaultImplprivate static classRealOptionalBinder.JavaOptionalProvider<T>Provides the binding for java.util.Optional. private static classRealOptionalBinder.JavaOptionalProviderProvider<T>Provides the binding for java.util.Optional>. private static classRealOptionalBinder.RealDirectTypeProvider<T>Provides the binding for T, conditionally installed by calling setBinding/setDefault.private static classRealOptionalBinder.RealOptionalBinderProviderWithDependencies<T,P>A base class for ProviderWithDependencies that need equality based on a specific object.private static classRealOptionalBinder.RealOptionalKeyProvider<T>Provides the binding for Optional. private static classRealOptionalBinder.RealOptionalProviderProvider<T>Provides the binding for Optional>. (package private) static classRealOptionalBinder.Source
-
Field Summary
Fields Modifier and Type Field Description private Binderbinderprivate RealOptionalBinder.BindingSelection<T>bindingSelection
-
Constructor Summary
Constructors Modifier Constructor Description privateRealOptionalBinder(Binder binder, Key<T> typeKey)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddDirectTypeBinding(Binder binder)Adds a binding for T.voidconfigure(Binder binder)Contributes bindings and other configurations for this module tobinder.booleanequals(java.lang.Object o)(package private) Key<T>getKeyForActualBinding()Returns the key to use for the actual binding, overrides the default if set.(package private) Key<T>getKeyForDefaultBinding()Returns the key to use for the default binding.inthashCode()(package private) static <T> TypeLiteral<java.util.Optional<T>>javaOptionalOf(TypeLiteral<T> type)(package private) static <T> TypeLiteral<java.util.Optional<javax.inject.Provider<T>>>javaOptionalOfJavaxProvider(TypeLiteral<T> type)(package private) static <T> TypeLiteral<java.util.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)(package private) static <T> Key<Provider<T>>providerOf(Key<T> key)LinkedBindingBuilder<T>setBinding()LinkedBindingBuilder<T>setDefault()
-
-
-
Field Detail
-
bindingSelection
private final RealOptionalBinder.BindingSelection<T> bindingSelection
-
binder
private final Binder binder
-
-
Method Detail
-
newRealOptionalBinder
public static <T> RealOptionalBinder<T> newRealOptionalBinder(Binder binder, Key<T> type)
-
optionalOf
static <T> TypeLiteral<com.google.common.base.Optional<T>> optionalOf(TypeLiteral<T> type)
-
javaOptionalOf
static <T> TypeLiteral<java.util.Optional<T>> javaOptionalOf(TypeLiteral<T> type)
-
optionalOfJavaxProvider
static <T> TypeLiteral<com.google.common.base.Optional<javax.inject.Provider<T>>> optionalOfJavaxProvider(TypeLiteral<T> type)
-
javaOptionalOfJavaxProvider
static <T> TypeLiteral<java.util.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
static <T> TypeLiteral<java.util.Optional<Provider<T>>> javaOptionalOfProvider(TypeLiteral<T> type)
-
addDirectTypeBinding
private void addDirectTypeBinding(Binder binder)
Adds a binding for T. Multiple calls to this are safe, and will be collapsed as duplicate bindings.
-
getKeyForDefaultBinding
Key<T> 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
public LinkedBindingBuilder<T> setDefault()
-
getKeyForActualBinding
Key<T> 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
public LinkedBindingBuilder<T> setBinding()
-
configure
public void configure(Binder binder)
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
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-