public final class QualifiedTypeBinder extends java.lang.Object implements QualifiedTypeListener
Modifier and Type | Field and Description |
---|---|
private com.google.inject.Binder |
binder |
private java.lang.Object |
currentSource |
private static boolean |
HAS_JSR299_TYPED |
private MediationListener |
mediationListener |
private static com.google.inject.TypeLiteral<java.lang.Object> |
OBJECT_TYPE_LITERAL |
private com.google.inject.Binder |
rootBinder |
Constructor and Description |
---|
QualifiedTypeBinder(com.google.inject.Binder binder) |
Modifier and Type | Method and Description |
---|---|
private void |
bindProviderType(java.lang.Class<?> providerType)
Binds the given provider type using a binding key determined by common-use heuristics.
|
private void |
bindQualifiedType(java.lang.Class<?> qualifiedType)
Binds the given qualified type using a binding key determined by common-use heuristics.
|
private static <T> com.google.inject.Key<T> |
getBindingKey(com.google.inject.TypeLiteral<T> bindingType,
java.lang.annotation.Annotation qualifier) |
private static com.google.inject.name.Named |
getBindingName(java.lang.Class<?> qualifiedType) |
private static java.lang.Class<?>[] |
getBindingTypes(java.lang.Class<?> clazz) |
void |
hear(java.lang.Class qualifiedType,
java.lang.Object source)
Invoked when the
QualifiedTypeVisitor finds a qualified type. |
private void |
installModule(java.lang.Class<com.google.inject.Module> moduleType)
Installs an instance of the given
Module . |
private static boolean |
isEagerSingleton(java.lang.Class<?> type) |
private static boolean |
isSingleton(java.lang.Class<?> type) |
private void |
mediate(com.google.inject.Key watchedKey,
Mediator mediator,
java.lang.Class watcherType)
Uses the given mediator to mediate updates between the
BeanLocator and associated watchers. |
private <T> T |
newInstance(java.lang.Class<T> type)
Attempts to create a new instance of the given type.
|
private void |
registerLegacyMediator(java.lang.Class<Mediator> mediatorType) |
private void |
registerMediator(java.lang.Class<Mediator> mediatorType)
Registers an instance of the given
Mediator using its generic type arguments as configuration. |
private static com.google.inject.TypeLiteral<?>[] |
resolveTypeArguments(java.lang.Class<?> type,
java.lang.Class<?> superType)
Resolves the type arguments of a super type based on the given concrete type.
|
private static <T> com.google.inject.Key<T> |
watchedKey(com.google.inject.TypeLiteral<T> type,
java.lang.Class qualifierType) |
private static final com.google.inject.TypeLiteral<java.lang.Object> OBJECT_TYPE_LITERAL
private static final boolean HAS_JSR299_TYPED
private final com.google.inject.Binder rootBinder
private MediationListener mediationListener
private java.lang.Object currentSource
private com.google.inject.Binder binder
public void hear(java.lang.Class qualifiedType, java.lang.Object source)
QualifiedTypeListener
QualifiedTypeVisitor
finds a qualified type.hear
in interface QualifiedTypeListener
qualifiedType
- The qualified typesource
- The source of this typeBinder.withSource(Object)
private void installModule(java.lang.Class<com.google.inject.Module> moduleType)
Module
.moduleType
- The module typeprivate void registerMediator(java.lang.Class<Mediator> mediatorType)
Mediator
using its generic type arguments as configuration.mediatorType
- The mediator typeprivate void registerLegacyMediator(java.lang.Class<Mediator> mediatorType)
private void mediate(com.google.inject.Key watchedKey, Mediator mediator, java.lang.Class watcherType)
BeanLocator
and associated watchers.watchedKey
- The watched keymediator
- The bean mediatorwatcherType
- The watcher typeprivate void bindProviderType(java.lang.Class<?> providerType)
providerType
- The provider typeprivate void bindQualifiedType(java.lang.Class<?> qualifiedType)
qualifiedType
- The qualified typeprivate <T> T newInstance(java.lang.Class<T> type)
type
- The instance typenull
if the instance couldn't be createdprivate static com.google.inject.TypeLiteral<?>[] resolveTypeArguments(java.lang.Class<?> type, java.lang.Class<?> superType)
type
- The concrete typesuperType
- The generic super typeprivate static <T> com.google.inject.Key<T> getBindingKey(com.google.inject.TypeLiteral<T> bindingType, java.lang.annotation.Annotation qualifier)
private static com.google.inject.name.Named getBindingName(java.lang.Class<?> qualifiedType)
private static java.lang.Class<?>[] getBindingTypes(java.lang.Class<?> clazz)
private static boolean isSingleton(java.lang.Class<?> type)
private static boolean isEagerSingleton(java.lang.Class<?> type)
private static <T> com.google.inject.Key<T> watchedKey(com.google.inject.TypeLiteral<T> type, java.lang.Class qualifierType)