Package org.eclipse.sisu.inject
Class RankedBindings<T>
- java.lang.Object
-
- org.eclipse.sisu.inject.RankedBindings<T>
-
- All Implemented Interfaces:
java.lang.Iterable<com.google.inject.Binding<T>>
,BindingSubscriber<T>
final class RankedBindings<T> extends java.lang.Object implements java.lang.Iterable<com.google.inject.Binding<T>>, BindingSubscriber<T>
Ordered sequence ofBinding
s of a given type; subscribes toBindingPublisher
s on demand.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
RankedBindings.Itr
Binding
iterator that only subscribes toBindingPublisher
s as required.
-
Field Summary
Fields Modifier and Type Field Description (package private) RankedSequence<com.google.inject.Binding<T>>
bindings
(package private) java.util.Collection<BeanCache<?,T>>
cachedBeans
(package private) RankedSequence<BindingPublisher>
pendingPublishers
(package private) com.google.inject.TypeLiteral<T>
type
-
Constructor Summary
Constructors Constructor Description RankedBindings(com.google.inject.TypeLiteral<T> type, RankedSequence<BindingPublisher> publishers)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(com.google.inject.Binding<T> binding, int rank)
Adds the given rankedBinding
to this subscriber.(package private) void
add(BindingPublisher publisher, int rank)
java.lang.Iterable<com.google.inject.Binding<T>>
bindings()
Snapshot of currently subscribedBinding
s.RankedBindings.Itr
iterator()
(package private) <Q extends java.lang.annotation.Annotation>
BeanCache<Q,T>newBeanCache()
void
remove(com.google.inject.Binding<T> binding)
Removes the givenBinding
from this subscriber.(package private) void
remove(BindingPublisher publisher)
com.google.inject.TypeLiteral<T>
type()
Returns the type ofBinding
s that are of interest.
-
-
-
Field Detail
-
bindings
final transient RankedSequence<com.google.inject.Binding<T>> bindings
-
type
final transient com.google.inject.TypeLiteral<T> type
-
pendingPublishers
final transient RankedSequence<BindingPublisher> pendingPublishers
-
-
Constructor Detail
-
RankedBindings
RankedBindings(com.google.inject.TypeLiteral<T> type, RankedSequence<BindingPublisher> publishers)
-
-
Method Detail
-
type
public com.google.inject.TypeLiteral<T> type()
Description copied from interface:BindingSubscriber
Returns the type ofBinding
s that are of interest.- Specified by:
type
in interfaceBindingSubscriber<T>
- Returns:
- The literal type
-
add
public void add(com.google.inject.Binding<T> binding, int rank)
Description copied from interface:BindingSubscriber
Adds the given rankedBinding
to this subscriber.- Specified by:
add
in interfaceBindingSubscriber<T>
- Parameters:
binding
- The new bindingrank
- The assigned rank
-
remove
public void remove(com.google.inject.Binding<T> binding)
Description copied from interface:BindingSubscriber
Removes the givenBinding
from this subscriber.- Specified by:
remove
in interfaceBindingSubscriber<T>
- Parameters:
binding
- The old binding
-
bindings
public java.lang.Iterable<com.google.inject.Binding<T>> bindings()
Description copied from interface:BindingSubscriber
Snapshot of currently subscribedBinding
s.- Specified by:
bindings
in interfaceBindingSubscriber<T>
- Returns:
- The subscribed
Binding
s
-
iterator
public RankedBindings.Itr iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<T>
-
add
void add(BindingPublisher publisher, int rank)
-
remove
void remove(BindingPublisher publisher)
-
-