public abstract class ProviderMethod<T> extends Object implements HasDependencies, ProvidesMethodBinding<T>, ProviderWithExtensionVisitor<T>
| Modifier and Type | Field and Description |
|---|---|
protected Object |
instance |
protected 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(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.
|
Annotation |
getAnnotation()
Returns the annotation that caused this binding to be created.
|
Set<Dependency<?>> |
getDependencies()
Returns the known dependencies for this type.
|
Object |
getEnclosingInstance()
Returns the instance of the object the method is defined in.
|
Object |
getInstance() |
Key<T> |
getKey()
Returns the key of the binding.
|
Method |
getMethod()
Returns the method this binding uses.
|
int |
hashCode() |
String |
toString() |
public Key<T> getKey()
ProvidesMethodBindinggetKey in interface ProvidesMethodBinding<T>public Method getMethod()
ProvidesMethodBindinggetMethod in interface ProvidesMethodBinding<T>public Object getInstance()
public Object getEnclosingInstance()
ProvidesMethodBindinggetEnclosingInstance in interface ProvidesMethodBinding<T>public 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 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 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 providedpublic final T get()
ProviderT.get in interface javax.inject.Provider<T>Copyright © 2006–2018 Google, Inc.. All rights reserved.