Package org.eclipse.sisu.space
Class QualifiedTypeBinder
java.lang.Object
org.eclipse.sisu.space.QualifiedTypeBinder
- All Implemented Interfaces:
QualifiedTypeListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate com.google.inject.Binderprivate Objectprivate static final booleanprivate MediationListenerprivate static final com.google.inject.TypeLiteral<Object> private final com.google.inject.Binder -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidbindProviderType(Class<?> providerType) Binds the given provider type using a binding key determined by common-use heuristics.private voidbindQualifiedInstance(Object qualifiedInstance) Binds the given qualified instance using a binding key determined by common-use heuristics.private voidbindQualifiedType(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, Annotation qualifier) private static com.google.inject.name.NamedgetBindingName(Class<?> qualifiedType) private static Class<?>[]getBindingTypes(Class<?> clazz) voidInvoked when theQualifiedTypeVisitorfinds a qualified type.private voidinstallModule(Class<com.google.inject.Module> moduleType) Installs an instance of the givenModule.private static booleanisEagerSingleton(Class<?> type) private static booleanisSingleton(Class<?> type) private voidUses the given mediator to mediate updates between theBeanLocatorand associated watchers.private <T> TnewInstance(Class<T> type) Attempts to create a new instance of the given type.private voidregisterLegacyMediator(Class<Mediator> mediatorType) private voidregisterMediator(Class<Mediator> mediatorType) Registers an instance of the givenMediatorusing its generic type arguments as configuration.private static com.google.inject.TypeLiteral<?>[]resolveTypeArguments(Class<?> type, 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, Class qualifierType)
-
Field Details
-
OBJECT_TYPE_LITERAL
-
HAS_JSR299_TYPED
private static final boolean HAS_JSR299_TYPED -
rootBinder
private final com.google.inject.Binder rootBinder -
mediationListener
-
currentSource
-
binder
private com.google.inject.Binder binder
-
-
Constructor Details
-
QualifiedTypeBinder
public QualifiedTypeBinder(com.google.inject.Binder binder)
-
-
Method Details
-
hear
Description copied from interface:QualifiedTypeListenerInvoked when theQualifiedTypeVisitorfinds a qualified type.- Specified by:
hearin interfaceQualifiedTypeListener- Parameters:
qualifiedType- The qualified typesource- The source of this type- See Also:
-
installModule
Installs an instance of the givenModule.- Parameters:
moduleType- The module type
-
registerMediator
Registers an instance of the givenMediatorusing its generic type arguments as configuration.- Parameters:
mediatorType- The mediator type
-
registerLegacyMediator
-
mediate
Uses the given mediator to mediate updates between theBeanLocatorand associated watchers.- Parameters:
watchedKey- The watched keymediator- The bean mediatorwatcherType- The watcher type
-
bindProviderType
Binds the given provider type using a binding key determined by common-use heuristics.- Parameters:
providerType- The provider type
-
bindQualifiedType
Binds the given qualified type using a binding key determined by common-use heuristics.- Parameters:
qualifiedType- The qualified type
-
bindQualifiedInstance
Binds the given qualified instance using a binding key determined by common-use heuristics.- Parameters:
qualifiedInstance- The qualified instance
-
newInstance
Attempts to create a new instance of the given type.- Parameters:
type- The instance type- Returns:
- New instance;
nullif the instance couldn't be created
-
resolveTypeArguments
private static com.google.inject.TypeLiteral<?>[] resolveTypeArguments(Class<?> type, Class<?> superType) Resolves the type arguments of a super type based on the given concrete type.- Parameters:
type- The concrete typesuperType- The generic super type- Returns:
- Resolved super type arguments
-
getBindingKey
private static <T> com.google.inject.Key<T> getBindingKey(com.google.inject.TypeLiteral<T> bindingType, Annotation qualifier) -
getBindingName
-
getBindingTypes
-
isSingleton
-
isEagerSingleton
-
watchedKey
private static <T> com.google.inject.Key<T> watchedKey(com.google.inject.TypeLiteral<T> type, Class qualifierType)
-