Class DefaultBeanLocator

java.lang.Object
org.eclipse.sisu.inject.DefaultBeanLocator
All Implemented Interfaces:
BeanLocator, MutableBeanLocator

public final class DefaultBeanLocator extends Object implements MutableBeanLocator
Default MutableBeanLocator that locates qualified beans across a dynamic group of BindingPublishers.
  • Field Details

  • Constructor Details

    • DefaultBeanLocator

      public DefaultBeanLocator()
  • Method Details

    • locate

      public Iterable<BeanEntry> locate(com.google.inject.Key key)
      Description copied from interface: BeanLocator
      Finds bean implementations that match the given qualified binding Key.
      Specified by:
      locate in interface BeanLocator
      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, Object watcher)
      Description copied from interface: BeanLocator
      Tracks bean implementations that match the given qualified binding Key.

      Uses the Mediator pattern to send events to an arbitrary watcher object.

      Specified by:
      watch in interface BeanLocator
      Parameters:
      key - The qualified key
      mediator - The event mediator
      watcher - The bean watcher
    • add

      public boolean add(BindingPublisher publisher)
      Description copied from interface: MutableBeanLocator
      Adds the given ranked BindingPublisher and distributes its Bindings.
      Specified by:
      add in interface MutableBeanLocator
      Parameters:
      publisher - The new publisher
      Returns:
      true if the publisher was added; otherwise false
    • remove

      public boolean remove(BindingPublisher publisher)
      Description copied from interface: MutableBeanLocator
      Removes the given BindingPublisher and its Bindings.
      Specified by:
      remove in interface MutableBeanLocator
      Parameters:
      publisher - The old publisher
      Returns:
      true if the publisher was removed; otherwise false
    • publishers

      public Iterable<BindingPublisher> publishers()
      Description copied from interface: MutableBeanLocator
      Snapshot of currently registered BindingPublishers.
      Specified by:
      publishers in interface MutableBeanLocator
      Returns:
      The registered BindingPublishers
    • clear

      public void clear()
      Description copied from interface: MutableBeanLocator
      Removes all known BindingPublishers and their Bindings.
      Specified by:
      clear in interface MutableBeanLocator
    • add

      public void add(com.google.inject.Injector injector, int rank)
      Description copied from interface: MutableBeanLocator
      Adds the given ranked Injector and distributes its Bindings. Marked as deprecated because most clients should not call this method; any injector with an instance binding to a BeanLocator is automatically added to that locator as part of the bootstrapping process.
      Specified by:
      add in interface MutableBeanLocator
      Parameters:
      injector - The new injector
      rank - The assigned rank; should reflect the injector's RankingFunction.maxRank()
    • remove

      public void remove(com.google.inject.Injector injector)
      Description copied from interface: MutableBeanLocator
      Removes the given Injector and its Bindings.
      Specified by:
      remove in interface MutableBeanLocator
      Parameters:
      injector - The old injector
    • fetchBindings

      private RankedBindings fetchBindings(com.google.inject.TypeLiteral type, Long[] idReturn)
      Fetches any bindings currently associated with the given type.
      Parameters:
      type - The generic type
      idReturn - Optional holder, returns the assigned type id
      Returns:
      Associated bindings; null if this is a new type
    • autoPublish

      @Inject void autoPublish(com.google.inject.Injector injector)
      Automatically publishes any Injector that contains a binding to this BeanLocator.
      Parameters:
      injector - The injector
    • staticAutoPublish

      @Inject static void staticAutoPublish(MutableBeanLocator locator, com.google.inject.Injector injector)