Package com.google.inject.internal
Class InstanceBindingImpl<T>
- java.lang.Object
-
- com.google.inject.internal.BindingImpl<T>
-
- com.google.inject.internal.InstanceBindingImpl<T>
-
- All Implemented Interfaces:
Binding<T>
,Element
,HasDependencies
,InstanceBinding<T>
final class InstanceBindingImpl<T> extends BindingImpl<T> implements InstanceBinding<T>
-
-
Field Summary
Fields Modifier and Type Field Description (package private) com.google.common.collect.ImmutableSet<InjectionPoint>
injectionPoints
(package private) T
instance
-
Constructor Summary
Constructors Constructor Description InstanceBindingImpl(InjectorImpl injector, Key<T> key, java.lang.Object source, InternalFactory<? extends T> internalFactory, java.util.Set<InjectionPoint> injectionPoints, T instance)
InstanceBindingImpl(java.lang.Object source, Key<T> key, Scoping scoping, java.util.Set<InjectionPoint> injectionPoints, T instance)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <V> V
acceptTargetVisitor(BindingTargetVisitor<? super T,V> visitor)
Accepts a target visitor.void
applyTo(Binder binder)
Writes this module element to the given binder (optional operation).boolean
equals(java.lang.Object obj)
java.util.Set<Dependency<?>>
getDependencies()
Returns the known dependencies for this type.java.util.Set<InjectionPoint>
getInjectionPoints()
Returns the field and method injection points of the instance, injected at injector-creation time only.T
getInstance()
Returns the user-supplied instance.int
hashCode()
java.lang.String
toString()
BindingImpl<T>
withKey(Key<T> key)
BindingImpl<T>
withScoping(Scoping scoping)
-
Methods inherited from class com.google.inject.internal.BindingImpl
acceptScopingVisitor, acceptVisitor, getInjector, getInternalFactory, getKey, getProvider, getScoping, getSource, isConstant
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.google.inject.Binding
acceptScopingVisitor, getKey, getProvider
-
Methods inherited from interface com.google.inject.spi.Element
acceptVisitor, getSource
-
-
-
-
Field Detail
-
instance
final T instance
-
injectionPoints
final com.google.common.collect.ImmutableSet<InjectionPoint> injectionPoints
-
-
Constructor Detail
-
InstanceBindingImpl
public InstanceBindingImpl(InjectorImpl injector, Key<T> key, java.lang.Object source, InternalFactory<? extends T> internalFactory, java.util.Set<InjectionPoint> injectionPoints, T instance)
-
InstanceBindingImpl
public InstanceBindingImpl(java.lang.Object source, Key<T> key, Scoping scoping, java.util.Set<InjectionPoint> injectionPoints, T instance)
-
-
Method Detail
-
acceptTargetVisitor
public <V> V acceptTargetVisitor(BindingTargetVisitor<? super T,V> visitor)
Description copied from interface:Binding
Accepts a target visitor. Invokes the visitor method specific to this binding's target.- Specified by:
acceptTargetVisitor
in interfaceBinding<T>
- Parameters:
visitor
- to call back on
-
getInstance
public T getInstance()
Description copied from interface:InstanceBinding
Returns the user-supplied instance.- Specified by:
getInstance
in interfaceInstanceBinding<T>
-
getInjectionPoints
public java.util.Set<InjectionPoint> getInjectionPoints()
Description copied from interface:InstanceBinding
Returns the field and method injection points of the instance, injected at injector-creation time only.- Specified by:
getInjectionPoints
in interfaceInstanceBinding<T>
- Returns:
- a possibly empty set
-
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 theInjector
will be included in the returned set.- Specified by:
getDependencies
in interfaceHasDependencies
- Returns:
- a possibly empty set
-
withScoping
public BindingImpl<T> withScoping(Scoping scoping)
- Overrides:
withScoping
in classBindingImpl<T>
-
withKey
public BindingImpl<T> withKey(Key<T> key)
- Overrides:
withKey
in classBindingImpl<T>
-
applyTo
public void applyTo(Binder binder)
Description copied from interface:Element
Writes this module element to the given binder (optional operation).
-
toString
public java.lang.String toString()
- Overrides:
toString
in classBindingImpl<T>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-