Package org.eclipse.sisu.inject
Class DefaultBeanLocator
- java.lang.Object
-
- org.eclipse.sisu.inject.DefaultBeanLocator
-
- All Implemented Interfaces:
BeanLocator,MutableBeanLocator
public final class DefaultBeanLocator extends java.lang.Object implements MutableBeanLocator
DefaultMutableBeanLocatorthat locates qualified beans across a dynamic group ofBindingPublishers.
-
-
Constructor Summary
Constructors Constructor Description DefaultBeanLocator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(com.google.inject.Injector injector, int rank)Adds the given rankedInjectorand distributes itsBindings.booleanadd(BindingPublisher publisher)Adds the given rankedBindingPublisherand distributes itsBindings.voidclear()Removes all knownBindingPublishers and theirBindings.java.lang.Iterable<BeanEntry>locate(com.google.inject.Key key)Finds bean implementations that match the given qualified bindingKey.java.lang.Iterable<BindingPublisher>publishers()Snapshot of currently registeredBindingPublishers.voidremove(com.google.inject.Injector injector)Removes the givenInjectorand itsBindings.booleanremove(BindingPublisher publisher)Removes the givenBindingPublisherand itsBindings.voidwatch(com.google.inject.Key key, Mediator mediator, java.lang.Object watcher)Tracks bean implementations that match the given qualified bindingKey.
-
-
-
Method Detail
-
locate
public java.lang.Iterable<BeanEntry> locate(com.google.inject.Key key)
Description copied from interface:BeanLocatorFinds bean implementations that match the given qualified bindingKey.- Specified by:
locatein interfaceBeanLocator- Parameters:
key- The qualified key- Returns:
- Sequence of bean entries that match the given key
-
watch
public void watch(com.google.inject.Key key, Mediator mediator, java.lang.Object watcher)Description copied from interface:BeanLocatorTracks bean implementations that match the given qualified bindingKey.Uses the
Mediatorpattern to send events to an arbitrary watcher object.- Specified by:
watchin interfaceBeanLocator- Parameters:
key- The qualified keymediator- The event mediatorwatcher- The bean watcher
-
add
public boolean add(BindingPublisher publisher)
Description copied from interface:MutableBeanLocatorAdds the given rankedBindingPublisherand distributes itsBindings.- Specified by:
addin interfaceMutableBeanLocator- Parameters:
publisher- The new publisher- Returns:
trueif the publisher was added; otherwisefalse
-
remove
public boolean remove(BindingPublisher publisher)
Description copied from interface:MutableBeanLocatorRemoves the givenBindingPublisherand itsBindings.- Specified by:
removein interfaceMutableBeanLocator- Parameters:
publisher- The old publisher- Returns:
trueif the publisher was removed; otherwisefalse
-
publishers
public java.lang.Iterable<BindingPublisher> publishers()
Description copied from interface:MutableBeanLocatorSnapshot of currently registeredBindingPublishers.- Specified by:
publishersin interfaceMutableBeanLocator- Returns:
- The registered
BindingPublishers
-
clear
public void clear()
Description copied from interface:MutableBeanLocatorRemoves all knownBindingPublishers and theirBindings.- Specified by:
clearin interfaceMutableBeanLocator
-
add
public void add(com.google.inject.Injector injector, int rank)Description copied from interface:MutableBeanLocatorAdds the given rankedInjectorand distributes itsBindings. Marked as deprecated because most clients should not call this method; any injector with an instance binding to aBeanLocatoris automatically added to that locator as part of the bootstrapping process.- Specified by:
addin interfaceMutableBeanLocator- Parameters:
injector- The new injectorrank- The assigned rank; should reflect the injector'sRankingFunction.maxRank()
-
remove
public void remove(com.google.inject.Injector injector)
Description copied from interface:MutableBeanLocatorRemoves the givenInjectorand itsBindings.- Specified by:
removein interfaceMutableBeanLocator- Parameters:
injector- The old injector
-
-