Package com.google.inject.assistedinject
Class Parameter
- java.lang.Object
-
- com.google.inject.assistedinject.Parameter
-
class Parameter extends java.lang.Object
Models a method or constructor parameter.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.annotation.Annotation
bindingAnnotation
private boolean
isAssisted
private boolean
isProvider
private Provider<? extends java.lang.Object>
provider
private java.lang.reflect.Type
type
-
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.Annotation
getBindingAnnotation(java.lang.annotation.Annotation[] annotations)
Returns the unique binding annotation from the specified list, ornull
if there are none.private Key<?>
getBindingForType(java.lang.reflect.Type type)
(package private) Key<?>
getPrimaryBindingKey()
private java.lang.reflect.Type
getProvidedType(java.lang.reflect.Type type)
java.lang.reflect.Type
getType()
java.lang.Object
getValue(Injector injector)
Returns the GuiceKey
for this parameter.private boolean
hasAssistedAnnotation(java.lang.annotation.Annotation[] annotations)
boolean
isBound(Injector injector)
private boolean
isBound(Injector injector, Key<?> key)
boolean
isProvidedByFactory()
private boolean
isProvider(java.lang.reflect.Type type)
java.lang.String
toString()
-
-
-
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:
toString
in classjava.lang.Object
-
hasAssistedAnnotation
private boolean hasAssistedAnnotation(java.lang.annotation.Annotation[] annotations)
-
getValue
public java.lang.Object getValue(Injector injector)
Returns the GuiceKey
for 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, ornull
if there are none.- Throws:
java.lang.IllegalStateException
- if multiple binding annotations exist.
-
-