public class Parameter
extends java.lang.Object
implements java.lang.reflect.AnnotatedElement
Modifier and Type | Class and Description |
---|---|
static class |
Parameter.BeanParameter
Bean Parameter class represents a parameter annotated with
BeanParam which in fact represents
additional set of parameters. |
private static interface |
Parameter.ParamAnnotationHelper<T extends java.lang.annotation.Annotation> |
static class |
Parameter.Source
Parameter injection sources type.
|
Modifier and Type | Field and Description |
---|---|
private static java.util.Map<java.lang.Class,Parameter.ParamAnnotationHelper> |
ANNOTATION_HELPER_MAP |
private java.lang.annotation.Annotation[] |
annotations |
private java.lang.String |
defaultValue |
private boolean |
encoded |
private static java.util.logging.Logger |
LOGGER |
private java.lang.Class<?> |
rawType |
private Parameter.Source |
source |
private java.lang.annotation.Annotation |
sourceAnnotation |
private java.lang.String |
sourceName |
private java.lang.reflect.Type |
type |
Modifier | Constructor and Description |
---|---|
private |
Parameter(java.lang.annotation.Annotation[] markers,
java.lang.annotation.Annotation marker,
Parameter.Source source,
java.lang.String sourceName,
java.lang.Class<?> rawType,
java.lang.reflect.Type type,
boolean encoded,
java.lang.String defaultValue) |
Modifier and Type | Method and Description |
---|---|
private static java.util.List<Parameter> |
create(java.lang.Class concreteClass,
java.lang.Class declaringClass,
boolean keepEncoded,
java.lang.Class[] parameterTypes,
java.lang.reflect.Type[] genericParameterTypes,
java.lang.annotation.Annotation[][] parameterAnnotations) |
static Parameter |
create(java.lang.Class concreteClass,
java.lang.Class declaringClass,
boolean encodeByDefault,
java.lang.Class<?> rawType,
java.lang.reflect.Type type,
java.lang.annotation.Annotation[] annotations)
Create a parameter model.
|
static java.util.List<Parameter> |
create(java.lang.Class concreteClass,
java.lang.Class declaringClass,
java.lang.reflect.Constructor<?> ctor,
boolean keepEncoded)
Create a list of parameter models for a given resource method handler
injectable constructor.
|
static java.util.List<Parameter> |
create(java.lang.Class concreteClass,
java.lang.Class declaringClass,
java.lang.reflect.Method javaMethod,
boolean keepEncoded)
Create a list of parameter models for a given Java method handling a resource
method, sub-resource method or a sub-resource locator.
|
private static java.util.Map<java.lang.Class,Parameter.ParamAnnotationHelper> |
createParamAnnotationHelperMap() |
boolean |
equals(java.lang.Object o) |
<T extends java.lang.annotation.Annotation> |
getAnnotation(java.lang.Class<T> annotationClass) |
java.lang.annotation.Annotation[] |
getAnnotations() |
java.lang.annotation.Annotation[] |
getDeclaredAnnotations() |
java.lang.String |
getDefaultValue()
Get the default parameter value.
|
java.lang.Class<?> |
getRawType()
Get raw type information for the parameter.
|
Parameter.Source |
getSource()
Get the parameter value source type.
|
java.lang.annotation.Annotation |
getSourceAnnotation()
Get the parameter source annotation.
|
java.lang.String |
getSourceName()
Get the parameter source name, i.e.
|
java.lang.reflect.Type |
getType()
Get generic type information for the parameter.
|
private static java.lang.String |
getValue(java.lang.annotation.Annotation a) |
boolean |
hasDefaultValue()
Check if the parameter has a default value set.
|
int |
hashCode() |
boolean |
isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass) |
boolean |
isEncoded()
If
true , the injected parameter value should remain encoded. |
boolean |
isQualified()
Check if the parameter is
qualified . |
static Parameter |
overrideSource(Parameter original,
Parameter.Source source)
Create new parameter model by overriding
source
of the original parameter model. |
java.lang.String |
toString() |
private static final java.util.logging.Logger LOGGER
private static final java.util.Map<java.lang.Class,Parameter.ParamAnnotationHelper> ANNOTATION_HELPER_MAP
private final java.lang.annotation.Annotation[] annotations
private final java.lang.annotation.Annotation sourceAnnotation
private final Parameter.Source source
private final java.lang.String sourceName
private final boolean encoded
private final java.lang.String defaultValue
private final java.lang.Class<?> rawType
private final java.lang.reflect.Type type
private Parameter(java.lang.annotation.Annotation[] markers, java.lang.annotation.Annotation marker, Parameter.Source source, java.lang.String sourceName, java.lang.Class<?> rawType, java.lang.reflect.Type type, boolean encoded, java.lang.String defaultValue)
private static java.util.Map<java.lang.Class,Parameter.ParamAnnotationHelper> createParamAnnotationHelperMap()
public static Parameter create(java.lang.Class concreteClass, java.lang.Class declaringClass, boolean encodeByDefault, java.lang.Class<?> rawType, java.lang.reflect.Type type, java.lang.annotation.Annotation[] annotations)
concreteClass
- concrete resource method handler implementation class.declaringClass
- declaring class of the method the parameter belongs to or field that this parameter represents.encodeByDefault
- flag indicating whether the parameter should be encoded by default or not. Note that a presence
of Encoded
annotation in the list of the parameter annotations
will override any
value set in the flag to true
.rawType
- raw Java parameter type.type
- generic Java parameter type.annotations
- parameter annotations.private static java.util.List<Parameter> create(java.lang.Class concreteClass, java.lang.Class declaringClass, boolean keepEncoded, java.lang.Class[] parameterTypes, java.lang.reflect.Type[] genericParameterTypes, java.lang.annotation.Annotation[][] parameterAnnotations)
public static java.util.List<Parameter> create(java.lang.Class concreteClass, java.lang.Class declaringClass, java.lang.reflect.Constructor<?> ctor, boolean keepEncoded)
concreteClass
- concrete resource method handler implementation class.declaringClass
- class where the method has been declared.ctor
- injectable constructor of the resource method handler.keepEncoded
- set to true
to disable automatic decoding
of all the constructor parameters. (See Encoded
.public static java.util.List<Parameter> create(java.lang.Class concreteClass, java.lang.Class declaringClass, java.lang.reflect.Method javaMethod, boolean keepEncoded)
concreteClass
- concrete resource method handler implementation class.declaringClass
- the class declaring the handling Java method.javaMethod
- Java method handling a resource method, sub-resource
method or a sub-resource locator.keepEncoded
- set to true
to disable automatic decoding
of all the method parameters. (See Encoded
.public static Parameter overrideSource(Parameter original, Parameter.Source source)
source
of the original parameter model.original
- original parameter model.source
- new overriding parameter source.private static java.lang.String getValue(java.lang.annotation.Annotation a)
public java.lang.annotation.Annotation getSourceAnnotation()
public Parameter.Source getSource()
public java.lang.String getSourceName()
public boolean isEncoded()
true
, the injected parameter value should remain encoded.true
if the parameter value should remain encoded,
false
otherwise.public boolean hasDefaultValue()
true
if the default parameter value has been set,
false
otherwise.public java.lang.String getDefaultValue()
null
if no default value has
been set for the parameter.public java.lang.Class<?> getRawType()
public java.lang.reflect.Type getType()
public boolean isQualified()
qualified
.true
if the parameter is qualified, false
otherwise.public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
isAnnotationPresent
in interface java.lang.reflect.AnnotatedElement
public <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> annotationClass)
getAnnotation
in interface java.lang.reflect.AnnotatedElement
public java.lang.annotation.Annotation[] getAnnotations()
getAnnotations
in interface java.lang.reflect.AnnotatedElement
public java.lang.annotation.Annotation[] getDeclaredAnnotations()
getDeclaredAnnotations
in interface java.lang.reflect.AnnotatedElement
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object