Package org.eclipse.sisu.inject
Class InjectorBindings
java.lang.Object
org.eclipse.sisu.inject.InjectorBindings
- All Implemented Interfaces:
BindingPublisher
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final com.google.inject.Key<BindingPublisher> private static final RankingFunctionprivate final RankingFunctionprivate final com.google.inject.Injectorprivate static final com.google.inject.Binding<?>[]private static final com.google.inject.TypeLiteral<Object> private static final com.google.inject.Key<RankingFunction> private com.google.inject.Binding<?>[] -
Constructor Summary
ConstructorsConstructorDescriptionInjectorBindings(com.google.inject.Injector injector) InjectorBindings(com.google.inject.Injector injector, RankingFunction function) -
Method Summary
Modifier and TypeMethodDescription<T> TAttempts to adapt this publisher to the given type.booleanstatic BindingPublisherfindBindingPublisher(com.google.inject.Injector injector) private static <T> com.google.inject.Binding<T> findExplicitBinding(com.google.inject.Injector injector, com.google.inject.Key<T> key) SearchesInjectorand its parents for an explicit binding of the givenKey.static RankingFunctionfindRankingFunction(com.google.inject.Injector injector) private com.google.inject.Binding<?>[]inthashCode()private static <T,S> boolean isAssignableFrom(com.google.inject.TypeLiteral<T> type, com.google.inject.Binding<S> binding) intEstimates the maximum rank this publisher may assign to aBinding.private <T> voidpublishExactMatches(com.google.inject.TypeLiteral<T> type, BindingSubscriber<T> subscriber) private <T,S> void publishGenericMatches(com.google.inject.TypeLiteral<T> type, BindingSubscriber<T> subscriber, Class<S> rawType) private <T> voidpublishWildcardMatches(com.google.inject.TypeLiteral<T> type, BindingSubscriber<T> subscriber) <T> voidsubscribe(BindingSubscriber<T> subscriber) Subscribes the givenBindingSubscriberto receiveBindings.toString()<T> voidunsubscribe(BindingSubscriber<T> subscriber) Stops the givenBindingSubscriberfrom receivingBindings.
-
Field Details
-
BINDING_PUBLISHER_KEY
-
RANKING_FUNCTION_KEY
-
DEFAULT_RANKING_FUNCTION
-
OBJECT_TYPE_LITERAL
-
NO_BINDINGS
private static final com.google.inject.Binding<?>[] NO_BINDINGS -
injector
private final com.google.inject.Injector injector -
function
-
wildcards
private volatile com.google.inject.Binding<?>[] wildcards
-
-
Constructor Details
-
InjectorBindings
-
InjectorBindings
@Inject public InjectorBindings(com.google.inject.Injector injector)
-
-
Method Details
-
findBindingPublisher
-
findRankingFunction
-
subscribe
Description copied from interface:BindingPublisherSubscribes the givenBindingSubscriberto receiveBindings.- Specified by:
subscribein interfaceBindingPublisher- Parameters:
subscriber- The subscriber
-
unsubscribe
Description copied from interface:BindingPublisherStops the givenBindingSubscriberfrom receivingBindings.- Specified by:
unsubscribein interfaceBindingPublisher- Parameters:
subscriber- The subscriber
-
maxBindingRank
public int maxBindingRank()Description copied from interface:BindingPublisherEstimates the maximum rank this publisher may assign to aBinding.- Specified by:
maxBindingRankin interfaceBindingPublisher- Returns:
- Maximum binding rank
-
adapt
Description copied from interface:BindingPublisherAttempts to adapt this publisher to the given type.- Specified by:
adaptin interfaceBindingPublisher- Parameters:
type- The target type- Returns:
- Adapted instance;
nullif it couldn't be adapted
-
hashCode
public int hashCode() -
equals
-
toString
-
findExplicitBinding
private static <T> com.google.inject.Binding<T> findExplicitBinding(com.google.inject.Injector injector, com.google.inject.Key<T> key) SearchesInjectorand its parents for an explicit binding of the givenKey.- Parameters:
injector- The injectorkey- The binding key- Returns:
- Explicit binding of the key;
nullif it doesn't exist
-
isAssignableFrom
private static <T,S> boolean isAssignableFrom(com.google.inject.TypeLiteral<T> type, com.google.inject.Binding<S> binding) -
publishExactMatches
private <T> void publishExactMatches(com.google.inject.TypeLiteral<T> type, BindingSubscriber<T> subscriber) -
publishGenericMatches
private <T,S> void publishGenericMatches(com.google.inject.TypeLiteral<T> type, BindingSubscriber<T> subscriber, Class<S> rawType) -
publishWildcardMatches
private <T> void publishWildcardMatches(com.google.inject.TypeLiteral<T> type, BindingSubscriber<T> subscriber) -
getWildcardBindings
private com.google.inject.Binding<?>[] getWildcardBindings()
-