Class LazyBeanEntry<Q extends java.lang.annotation.Annotation,​T>

  • All Implemented Interfaces:
    java.util.Map.Entry<Q,​T>, BeanEntry<Q,​T>

    final class LazyBeanEntry<Q extends java.lang.annotation.Annotation,​T>
    extends java.lang.Object
    implements BeanEntry<Q,​T>
    Lazy BeanEntry backed by a qualified Binding and an assigned rank.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  LazyBeanEntry.JsrNamed
      Implementation of @Named that can also act like @Named.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) com.google.inject.Binding<T> binding  
      private javax.inject.Provider<T> lazyValue  
      private Q qualifier  
      private int rank  
    • Constructor Summary

      Constructors 
      Constructor Description
      LazyBeanEntry​(Q qualifier, com.google.inject.Binding<T> binding, int rank)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getDescription()
      Returns a human-readable description of the bean; see @Description.
      java.lang.Class<T> getImplementationClass()
      Attempts to find the implementation type without creating the bean instance.
      Q getKey()
      Returns the @Qualifier annotation associated with this particular bean.
      javax.inject.Provider<T> getProvider()
      Returns the underlying Provider; may support creation of multiple instances.
      int getRank()
      Returns the bean's rank; higher ranked beans override lower ranked beans.
      java.lang.Object getSource()
      Returns an arbitrary object that indicates where this bean was configured.
      T getValue()
      Returns the associated instance of the bean; returns same instance for each call.
      T setValue​(T value)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map.Entry

        equals, hashCode
    • Field Detail

      • qualifier

        private final Q extends java.lang.annotation.Annotation qualifier
      • binding

        final com.google.inject.Binding<T> binding
      • lazyValue

        private final javax.inject.Provider<T> lazyValue
      • rank

        private final int rank
    • Constructor Detail

      • LazyBeanEntry

        LazyBeanEntry​(Q qualifier,
                      com.google.inject.Binding<T> binding,
                      int rank)
    • Method Detail

      • getKey

        public Q getKey()
        Description copied from interface: BeanEntry
        Returns the @Qualifier annotation associated with this particular bean.
        Specified by:
        getKey in interface BeanEntry<Q extends java.lang.annotation.Annotation,​T>
        Specified by:
        getKey in interface java.util.Map.Entry<Q extends java.lang.annotation.Annotation,​T>
        Returns:
        Qualifier annotation
      • getValue

        public T getValue()
        Description copied from interface: BeanEntry
        Returns the associated instance of the bean; returns same instance for each call.
        Specified by:
        getValue in interface BeanEntry<Q extends java.lang.annotation.Annotation,​T>
        Specified by:
        getValue in interface java.util.Map.Entry<Q extends java.lang.annotation.Annotation,​T>
        Returns:
        Bean instance (lazily-created)
      • setValue

        public T setValue​(T value)
        Specified by:
        setValue in interface java.util.Map.Entry<Q extends java.lang.annotation.Annotation,​T>
      • getProvider

        public javax.inject.Provider<T> getProvider()
        Description copied from interface: BeanEntry
        Returns the underlying Provider; may support creation of multiple instances.
        Specified by:
        getProvider in interface BeanEntry<Q extends java.lang.annotation.Annotation,​T>
        Returns:
        Bean provider
      • getDescription

        public java.lang.String getDescription()
        Description copied from interface: BeanEntry
        Returns a human-readable description of the bean; see @Description.
        Specified by:
        getDescription in interface BeanEntry<Q extends java.lang.annotation.Annotation,​T>
        Returns:
        Human-readable description
        See Also:
        Description
      • getImplementationClass

        public java.lang.Class<T> getImplementationClass()
        Description copied from interface: BeanEntry
        Attempts to find the implementation type without creating the bean instance.
        Specified by:
        getImplementationClass in interface BeanEntry<Q extends java.lang.annotation.Annotation,​T>
        Returns:
        Implementation type; null if the type cannot be determined
      • getSource

        public java.lang.Object getSource()
        Description copied from interface: BeanEntry
        Returns an arbitrary object that indicates where this bean was configured.
        Specified by:
        getSource in interface BeanEntry<Q extends java.lang.annotation.Annotation,​T>
        Returns:
        Source location
      • getRank

        public int getRank()
        Description copied from interface: BeanEntry
        Returns the bean's rank; higher ranked beans override lower ranked beans.
        Specified by:
        getRank in interface BeanEntry<Q extends java.lang.annotation.Annotation,​T>
        Returns:
        Assigned rank
        See Also:
        Priority
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object