Package com.google.inject.internal
Class ConstructorBindingImpl<T>
- java.lang.Object
-
- com.google.inject.internal.BindingImpl<T>
-
- com.google.inject.internal.ConstructorBindingImpl<T>
-
- All Implemented Interfaces:
Binding<T>,DelayedInitialize,ConstructorBinding<T>,Element,HasDependencies
final class ConstructorBindingImpl<T> extends BindingImpl<T> implements ConstructorBinding<T>, DelayedInitialize
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classConstructorBindingImpl.Factory<T>
-
Field Summary
Fields Modifier and Type Field Description private InjectionPointconstructorInjectionPointprivate ConstructorBindingImpl.Factory<T>factory
-
Constructor Summary
Constructors Modifier Constructor Description privateConstructorBindingImpl(InjectorImpl injector, Key<T> key, java.lang.Object source, InternalFactory<? extends T> scopedFactory, Scoping scoping, ConstructorBindingImpl.Factory<T> factory, InjectionPoint constructorInjectionPoint)ConstructorBindingImpl(Key<T> key, java.lang.Object source, Scoping scoping, InjectionPoint constructorInjectionPoint, java.util.Set<InjectionPoint> injectionPoints)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <V> VacceptTargetVisitor(BindingTargetVisitor<? super T,V> visitor)Accepts a target visitor.voidapplyTo(Binder binder)Writes this module element to the given binder (optional operation).(package private) static <T> ConstructorBindingImpl<T>create(InjectorImpl injector, Key<T> key, InjectionPoint constructorInjector, java.lang.Object source, Scoping scoping, Errors errors, boolean failIfNotLinked, boolean atInjectRequired)booleanequals(java.lang.Object obj)InjectionPointgetConstructor()Gets the constructor this binding injects.java.util.Set<Dependency<?>>getDependencies()Returns the known dependencies for this type.java.util.Set<InjectionPoint>getInjectableMembers()Returns all instance method and field injection points ontype.(package private) InjectionPointgetInternalConstructor()Returns an injection point that can be used to clean up the constructor store.(package private) java.util.Set<Dependency<?>>getInternalDependencies()Returns a set of dependencies that can be iterated over to clean up stray JIT bindings.java.util.Map<java.lang.reflect.Method,java.util.List<org.aopalliance.intercept.MethodInterceptor>>getMethodInterceptors()Returns the interceptors applied to each method, in the order that they will be applied.inthashCode()voidinitialize(InjectorImpl injector, Errors errors)Initializes this binding, throwing any errors if necessary.(package private) booleanisInitialized()True if this binding has been initialized and is ready for use.java.lang.StringtoString()protected BindingImpl<T>withKey(Key<T> key)protected 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
-
factory
private final ConstructorBindingImpl.Factory<T> factory
-
constructorInjectionPoint
private final InjectionPoint constructorInjectionPoint
-
-
Constructor Detail
-
ConstructorBindingImpl
private ConstructorBindingImpl(InjectorImpl injector, Key<T> key, java.lang.Object source, InternalFactory<? extends T> scopedFactory, Scoping scoping, ConstructorBindingImpl.Factory<T> factory, InjectionPoint constructorInjectionPoint)
-
ConstructorBindingImpl
public ConstructorBindingImpl(Key<T> key, java.lang.Object source, Scoping scoping, InjectionPoint constructorInjectionPoint, java.util.Set<InjectionPoint> injectionPoints)
-
-
Method Detail
-
create
static <T> ConstructorBindingImpl<T> create(InjectorImpl injector, Key<T> key, InjectionPoint constructorInjector, java.lang.Object source, Scoping scoping, Errors errors, boolean failIfNotLinked, boolean atInjectRequired) throws ErrorsException
- Parameters:
constructorInjector- the constructor to use, ornullto use the default.failIfNotLinked- true if this ConstructorBindingImpl's InternalFactory should only succeed if retrieved from a linked binding- Throws:
ErrorsException
-
initialize
public void initialize(InjectorImpl injector, Errors errors) throws ErrorsException
Description copied from interface:DelayedInitializeInitializes this binding, throwing any errors if necessary.- Specified by:
initializein interfaceDelayedInitialize- Throws:
ErrorsException
-
isInitialized
boolean isInitialized()
True if this binding has been initialized and is ready for use.
-
getInternalConstructor
InjectionPoint getInternalConstructor()
Returns an injection point that can be used to clean up the constructor store.
-
getInternalDependencies
java.util.Set<Dependency<?>> getInternalDependencies()
Returns a set of dependencies that can be iterated over to clean up stray JIT bindings.
-
acceptTargetVisitor
public <V> V acceptTargetVisitor(BindingTargetVisitor<? super T,V> visitor)
Description copied from interface:BindingAccepts a target visitor. Invokes the visitor method specific to this binding's target.- Specified by:
acceptTargetVisitorin interfaceBinding<T>- Parameters:
visitor- to call back on
-
getConstructor
public InjectionPoint getConstructor()
Description copied from interface:ConstructorBindingGets the constructor this binding injects.- Specified by:
getConstructorin interfaceConstructorBinding<T>
-
getInjectableMembers
public java.util.Set<InjectionPoint> getInjectableMembers()
Description copied from interface:ConstructorBindingReturns all instance method and field injection points ontype.- Specified by:
getInjectableMembersin interfaceConstructorBinding<T>- Returns:
- a possibly empty set of injection points. The set has a specified iteration order. All fields are returned and then all methods. Within the fields, supertype fields are returned before subtype fields. Similarly, supertype methods are returned before subtype methods.
-
getMethodInterceptors
public java.util.Map<java.lang.reflect.Method,java.util.List<org.aopalliance.intercept.MethodInterceptor>> getMethodInterceptors()
Description copied from interface:ConstructorBindingReturns the interceptors applied to each method, in the order that they will be applied.- Specified by:
getMethodInterceptorsin interfaceConstructorBinding<T>- Returns:
- a possibly empty map
-
getDependencies
public java.util.Set<Dependency<?>> getDependencies()
Description copied from interface:HasDependenciesReturns the known dependencies for this type. If this has dependencies whose values are not known statically, a dependency for theInjectorwill be included in the returned set.- Specified by:
getDependenciesin interfaceHasDependencies- Returns:
- a possibly empty set
-
withScoping
protected BindingImpl<T> withScoping(Scoping scoping)
- Overrides:
withScopingin classBindingImpl<T>
-
withKey
protected BindingImpl<T> withKey(Key<T> key)
- Overrides:
withKeyin classBindingImpl<T>
-
applyTo
public void applyTo(Binder binder)
Description copied from interface:ElementWrites this module element to the given binder (optional operation).
-
toString
public java.lang.String toString()
- Overrides:
toStringin classBindingImpl<T>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-