public abstract class ProviderMethod<T> extends java.lang.Object implements HasDependencies, ProvidesMethodBinding<T>, ProviderWithExtensionVisitor<T>
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Object |
instance |
protected java.lang.reflect.Method |
method |
| Modifier and Type | Method and 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)
Creates an object to be injected.
|
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() |
protected final java.lang.Object instance
protected final java.lang.reflect.Method method
public Key<T> getKey()
ProvidesMethodBindinggetKey in interface ProvidesMethodBinding<T>public java.lang.reflect.Method getMethod()
ProvidesMethodBindinggetMethod in interface ProvidesMethodBinding<T>public java.lang.Object getInstance()
public java.lang.Object getEnclosingInstance()
ProvidesMethodBindinggetEnclosingInstance in interface ProvidesMethodBinding<T>public java.lang.annotation.Annotation getAnnotation()
ProvidesMethodBinding@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.getAnnotation in interface ProvidesMethodBinding<T>public void configure(Binder binder)
protected T doProvision(com.google.inject.internal.InternalContext context, Dependency<?> dependency) throws InternalProvisionException
InternalProvisionException - if a value cannot be providedpublic java.util.Set<Dependency<?>> getDependencies()
HasDependenciesInjector will be
included in the returned set.getDependencies in interface HasDependenciespublic <B,V> V acceptExtensionVisitor(BindingTargetVisitor<B,V> visitor, ProviderInstanceBinding<? extends B> binding)
ProviderWithExtensionVisitorDue 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'.
acceptExtensionVisitor in interface ProviderWithExtensionVisitor<T>public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic final T get(com.google.inject.internal.InternalContext context,
Dependency<?> dependency,
boolean linked)
throws InternalProvisionException
context - of this injectionlinked - true if getting as a result of a linked bindingInternalProvisionException - if a value cannot be provided