Package com.google.inject.assistedinject
Class Parameter
- java.lang.Object
-
- com.google.inject.assistedinject.Parameter
-
class Parameter extends java.lang.ObjectModels a method or constructor parameter.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.annotation.AnnotationbindingAnnotationprivate booleanisAssistedprivate booleanisProviderprivate Provider<? extends java.lang.Object>providerprivate java.lang.reflect.Typetype
-
Constructor Summary
Constructors Constructor Description Parameter(java.lang.reflect.Type type, java.lang.annotation.Annotation[] annotations)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Key<?>fixAnnotations(Key<?> key)Replace annotation instances with annotation types, this is only appropriate for testing if a key is bound and not for injecting.private java.lang.annotation.AnnotationgetBindingAnnotation(java.lang.annotation.Annotation[] annotations)Returns the unique binding annotation from the specified list, ornullif there are none.private Key<?>getBindingForType(java.lang.reflect.Type type)(package private) Key<?>getPrimaryBindingKey()private java.lang.reflect.TypegetProvidedType(java.lang.reflect.Type type)java.lang.reflect.TypegetType()java.lang.ObjectgetValue(Injector injector)Returns the GuiceKeyfor this parameter.private booleanhasAssistedAnnotation(java.lang.annotation.Annotation[] annotations)booleanisBound(Injector injector)private booleanisBound(Injector injector, Key<?> key)booleanisProvidedByFactory()private booleanisProvider(java.lang.reflect.Type type)java.lang.StringtoString()
-
-
-
Field Detail
-
type
private final java.lang.reflect.Type type
-
isAssisted
private final boolean isAssisted
-
bindingAnnotation
private final java.lang.annotation.Annotation bindingAnnotation
-
isProvider
private final boolean isProvider
-
provider
private volatile Provider<? extends java.lang.Object> provider
-
-
Method Detail
-
isProvidedByFactory
public boolean isProvidedByFactory()
-
getType
public java.lang.reflect.Type getType()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hasAssistedAnnotation
private boolean hasAssistedAnnotation(java.lang.annotation.Annotation[] annotations)
-
getValue
public java.lang.Object getValue(Injector injector)
Returns the GuiceKeyfor this parameter.
-
isBound
public boolean isBound(Injector injector)
-
fixAnnotations
public Key<?> fixAnnotations(Key<?> key)
Replace annotation instances with annotation types, this is only appropriate for testing if a key is bound and not for injecting.See Guice bug 125, https://github.com/google/guice/issues/125
-
getPrimaryBindingKey
Key<?> getPrimaryBindingKey()
-
getProvidedType
private java.lang.reflect.Type getProvidedType(java.lang.reflect.Type type)
-
isProvider
private boolean isProvider(java.lang.reflect.Type type)
-
getBindingForType
private Key<?> getBindingForType(java.lang.reflect.Type type)
-
getBindingAnnotation
private java.lang.annotation.Annotation getBindingAnnotation(java.lang.annotation.Annotation[] annotations)
Returns the unique binding annotation from the specified list, ornullif there are none.- Throws:
java.lang.IllegalStateException- if multiple binding annotations exist.
-
-