Modifier and Type | Class and Description |
---|---|
(package private) static interface |
RealOptionalBinder.Actual |
(package private) static class |
RealOptionalBinder.ActualImpl |
(package private) static class |
RealOptionalBinder.BaseAnnotation |
private static class |
RealOptionalBinder.BindingSelection<T>
A helper object that implements the core logic for deciding what the implementation of the
binding will be.
|
(package private) static interface |
RealOptionalBinder.Default |
(package private) static class |
RealOptionalBinder.DefaultImpl |
private static class |
RealOptionalBinder.JavaOptionalProvider
Provides the binding for java.util.Optional
|
private static class |
RealOptionalBinder.JavaOptionalProviderProvider
Provides the binding for java.util.Optional
|
private static class |
RealOptionalBinder.RealDirectTypeProvider<T>
Provides the binding for T, conditionally installed by calling setBinding/setDefault.
|
private static class |
RealOptionalBinder.RealOptionalBinderProviderWithDependencies<T,P>
A base class for ProviderWithDependencies that need equality based on a specific object.
|
private static class |
RealOptionalBinder.RealOptionalKeyProvider<T>
Provides the binding for Optional
|
private static class |
RealOptionalBinder.RealOptionalProviderProvider<T>
Provides the binding for Optional
|
(package private) static class |
RealOptionalBinder.Source |
Modifier and Type | Field and Description |
---|---|
private Binder |
binder |
private RealOptionalBinder.BindingSelection<T> |
bindingSelection |
private static java.lang.Class<?> |
JAVA_OPTIONAL_CLASS |
private static java.lang.Object |
JAVA_OPTIONAL_EMPTY |
private static java.lang.reflect.Method |
JAVA_OPTIONAL_OF_METHOD |
Modifier | Constructor and Description |
---|---|
private |
RealOptionalBinder(Binder binder,
Key<T> typeKey) |
Modifier and Type | Method and Description |
---|---|
private void |
addDirectTypeBinding(Binder binder)
Adds a binding for T.
|
private void |
bindJava8Optional(Binder binder) |
void |
configure(Binder binder)
Contributes bindings and other configurations for this module to
binder . |
boolean |
equals(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.
|
int |
hashCode() |
private static java.lang.Object |
invokeJavaOptionalOf(java.lang.Object o)
Invokes java.util.Optional.of.
|
private static java.lang.Object |
invokeJavaOptionalOfNullable(java.lang.Object o)
Returns java.util.Optional.empty() if the parameter is null, calls
invokeJavaOptionalOf(java.lang.Object) otherwise. |
(package private) static <T> TypeLiteral<?> |
javaOptionalOf(TypeLiteral<T> type) |
(package private) static <T> TypeLiteral<?> |
javaOptionalOfJavaxProvider(TypeLiteral<T> type) |
(package private) static <T> TypeLiteral<?> |
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() |
private static final java.lang.Class<?> JAVA_OPTIONAL_CLASS
private static final java.lang.Object JAVA_OPTIONAL_EMPTY
private static final java.lang.reflect.Method JAVA_OPTIONAL_OF_METHOD
private final RealOptionalBinder.BindingSelection<T> bindingSelection
private final Binder binder
public static <T> RealOptionalBinder<T> newRealOptionalBinder(Binder binder, Key<T> type)
private static java.lang.Object invokeJavaOptionalOfNullable(java.lang.Object o)
invokeJavaOptionalOf(java.lang.Object)
otherwise.private static java.lang.Object invokeJavaOptionalOf(java.lang.Object o)
static <T> TypeLiteral<com.google.common.base.Optional<T>> optionalOf(TypeLiteral<T> type)
static <T> TypeLiteral<?> javaOptionalOf(TypeLiteral<T> type)
static <T> TypeLiteral<com.google.common.base.Optional<javax.inject.Provider<T>>> optionalOfJavaxProvider(TypeLiteral<T> type)
static <T> TypeLiteral<?> javaOptionalOfJavaxProvider(TypeLiteral<T> type)
static <T> TypeLiteral<com.google.common.base.Optional<Provider<T>>> optionalOfProvider(TypeLiteral<T> type)
static <T> TypeLiteral<?> javaOptionalOfProvider(TypeLiteral<T> type)
private void addDirectTypeBinding(Binder binder)
Key<T> getKeyForDefaultBinding()
As a side effect this installs support for the 'direct type', so a binding for T
will be made available.
public LinkedBindingBuilder<T> setDefault()
Key<T> getKeyForActualBinding()
As a side effect this installs support for the 'direct type', so a binding for T
will be made available.
public LinkedBindingBuilder<T> setBinding()
public void configure(Binder binder)
Module
binder
.
Do not invoke this method directly to install submodules. Instead use
Binder.install(Module)
, which ensures that provider methods
are
discovered.
private void bindJava8Optional(Binder binder)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object