Class ProviderMethod<T>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.Object instance  
      protected java.lang.reflect.Method method  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <B,​V>
      V
      acceptExtensionVisitor​(BindingTargetVisitor<B,​V> visitor, ProviderInstanceBinding<? extends B> binding)
      Instructs the extension determine if the visitor is an instance of a custom extension visitor, and if so, visit it using that method.
      void configure​(Binder binder)  
      protected T doProvision​(com.google.inject.internal.InternalContext context, Dependency<?> dependency)
      Creates an object to be injected.
      boolean equals​(java.lang.Object obj)  
      T get()
      Provides an instance of T.
      T get​(com.google.inject.internal.InternalContext context, Dependency<?> dependency, boolean linked)  
      java.lang.annotation.Annotation getAnnotation()
      Returns the annotation that caused this binding to be created.
      java.util.Set<Dependency<?>> getDependencies()
      Returns the known dependencies for this type.
      java.lang.Object getEnclosingInstance()
      Returns the instance of the object the method is defined in.
      java.lang.Object getInstance()  
      Key<T> getKey()
      Returns the key of the binding.
      java.lang.reflect.Method getMethod()
      Returns the method this binding uses.
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface com.google.inject.Provider

        get
    • Field Detail

      • instance

        protected final java.lang.Object instance
      • method

        protected final java.lang.reflect.Method method
    • Method Detail

      • getInstance

        public java.lang.Object getInstance()
      • getAnnotation

        public java.lang.annotation.Annotation getAnnotation()
        Description copied from interface: ProvidesMethodBinding
        Returns the annotation that caused this binding to be created. For @Provides methods, this is an instance of the @Provides annotation. For bindings from ModuleAnnotatedMethodScanner, this is the annotation that caused the scanner to produce the binding.
        Specified by:
        getAnnotation in interface ProvidesMethodBinding<T>
      • configure

        public void configure​(Binder binder)
      • getDependencies

        public java.util.Set<Dependency<?>> getDependencies()
        Description copied from interface: HasDependencies
        Returns the known dependencies for this type. If this has dependencies whose values are not known statically, a dependency for the Injector will be included in the returned set.
        Specified by:
        getDependencies in interface HasDependencies
        Returns:
        a possibly empty set
      • acceptExtensionVisitor

        public <B,​V> V acceptExtensionVisitor​(BindingTargetVisitor<B,​V> visitor,
                                                    ProviderInstanceBinding<? extends B> binding)
        Description copied from interface: ProviderWithExtensionVisitor
        Instructs the extension determine if the visitor is an instance of a custom extension visitor, and if so, visit it using that method. If the visitor is not an instance of the custom extension visitor, this method MUST call visitor.visit(binding).

        Due to issues with generics, the type parameters of this method do not relate to the type of the provider. In practice, the 'B' type will always be a supertype of 'T'.

        Specified by:
        acceptExtensionVisitor in interface ProviderWithExtensionVisitor<T>
      • toString

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • get

        public final T get()
        Description copied from interface: Provider
        Provides an instance of T.
        Specified by:
        get in interface Provider<T>
        Specified by:
        get in interface javax.inject.Provider<T>