Class 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 of Bindings of a given type; subscribes to BindingPublishers on demand.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) class  RankedBindings.Itr
      Binding iterator that only subscribes to BindingPublishers as required.
    • 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 ranked Binding to this subscriber.
      (package private) void add​(BindingPublisher publisher, int rank)  
      java.lang.Iterable<com.google.inject.Binding<T>> bindings()
      Snapshot of currently subscribed Bindings.
      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 given Binding from this subscriber.
      (package private) void remove​(BindingPublisher publisher)  
      com.google.inject.TypeLiteral<T> type()
      Returns the type of Bindings that are of interest.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • bindings

        final transient RankedSequence<com.google.inject.Binding<T>> bindings
      • type

        final transient com.google.inject.TypeLiteral<T> type
      • cachedBeans

        final java.util.Collection<BeanCache<?,​T>> cachedBeans
    • Method Detail

      • type

        public com.google.inject.TypeLiteral<T> type()
        Description copied from interface: BindingSubscriber
        Returns the type of Bindings that are of interest.
        Specified by:
        type in interface BindingSubscriber<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 ranked Binding to this subscriber.
        Specified by:
        add in interface BindingSubscriber<T>
        Parameters:
        binding - The new binding
        rank - The assigned rank
      • remove

        public void remove​(com.google.inject.Binding<T> binding)
        Description copied from interface: BindingSubscriber
        Removes the given Binding from this subscriber.
        Specified by:
        remove in interface BindingSubscriber<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 subscribed Bindings.
        Specified by:
        bindings in interface BindingSubscriber<T>
        Returns:
        The subscribed Bindings
      • iterator

        public RankedBindings.Itr iterator()
        Specified by:
        iterator in interface java.lang.Iterable<T>
      • newBeanCache

        <Q extends java.lang.annotation.Annotation> BeanCache<Q,​T> newBeanCache()