public abstract class ProviderMethod<T> extends Object implements ProviderWithExtensionVisitor<T>, HasDependencies, ProvidesMethodBinding<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) |
boolean |
equals(Object obj) |
T |
get()
Provides an instance of
T . |
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()
ProvidesMethodBinding
getKey
in interface ProvidesMethodBinding<T>
public Method getMethod()
ProvidesMethodBinding
getMethod
in interface ProvidesMethodBinding<T>
public Object getInstance()
public Object getEnclosingInstance()
ProvidesMethodBinding
getEnclosingInstance
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)
public T get()
Provider
T
. Must never return null
.get
in interface javax.inject.Provider<T>
public Set<Dependency<?>> getDependencies()
HasDependencies
Injector
will be
included in the returned set.getDependencies
in interface HasDependencies
public <B,V> V acceptExtensionVisitor(BindingTargetVisitor<B,V> visitor, ProviderInstanceBinding<? extends B> binding)
ProviderWithExtensionVisitor
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'.
acceptExtensionVisitor
in interface ProviderWithExtensionVisitor<T>
Copyright © 2006-2016 Google, Inc.. All Rights Reserved.