Class Parameter
java.lang.Object
org.glassfish.jersey.server.model.Parameter
- All Implemented Interfaces:
AnnotatedElement
- Direct Known Subclasses:
Parameter.BeanParameter
Method parameter model.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Bean Parameter class represents a parameter annotated withBeanParam
which in fact represents additional set of parameters.private static interface
Parameter.ParamAnnotationHelper<T extends Annotation>
static enum
Parameter injection sources type. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Map<Class,
Parameter.ParamAnnotationHelper> private final Annotation[]
private final String
private final boolean
private static final Logger
private final Class<?>
private final Parameter.Source
private final Annotation
private final String
private final Type
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Parameter
(Annotation[] markers, Annotation marker, Parameter.Source source, String sourceName, Class<?> rawType, Type type, boolean encoded, String defaultValue) -
Method Summary
Modifier and TypeMethodDescriptioncreate
(Class concreteClass, Class declaringClass, boolean keepEncoded, Class[] parameterTypes, Type[] genericParameterTypes, Annotation[][] parameterAnnotations) static Parameter
create
(Class concreteClass, Class declaringClass, boolean encodeByDefault, Class<?> rawType, Type type, Annotation[] annotations) Create a parameter model.create
(Class concreteClass, Class declaringClass, Constructor<?> ctor, boolean keepEncoded) Create a list of parameter models for a given resource method handler injectable constructor.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 Map<Class,
Parameter.ParamAnnotationHelper> boolean
<T extends Annotation>
TgetAnnotation
(Class<T> annotationClass) Get the default parameter value.Class<?>
Get raw type information for the parameter.Get the parameter value source type.Get the parameter source annotation.Get the parameter source name, i.e.getType()
Get generic type information for the parameter.private static String
boolean
Check if the parameter has a default value set.int
hashCode()
boolean
isAnnotationPresent
(Class<? extends Annotation> annotationClass) boolean
Iftrue
, the injected parameter value should remain encoded.boolean
Check if the parameter isqualified
.static Parameter
overrideSource
(Parameter original, Parameter.Source source) Create new parameter model by overridingsource
of the original parameter model.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.reflect.AnnotatedElement
getAnnotationsByType, getDeclaredAnnotation, getDeclaredAnnotationsByType
-
Field Details
-
LOGGER
-
ANNOTATION_HELPER_MAP
-
annotations
-
sourceAnnotation
-
source
-
sourceName
-
encoded
private final boolean encoded -
defaultValue
-
rawType
-
type
-
-
Constructor Details
-
Parameter
private Parameter(Annotation[] markers, Annotation marker, Parameter.Source source, String sourceName, Class<?> rawType, Type type, boolean encoded, String defaultValue)
-
-
Method Details
-
createParamAnnotationHelperMap
-
create
public static Parameter create(Class concreteClass, Class declaringClass, boolean encodeByDefault, Class<?> rawType, Type type, Annotation[] annotations) Create a parameter model.- Parameters:
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 ofEncoded
annotation in the list of the parameterannotations
will override any value set in the flag totrue
.rawType
- raw Java parameter type.type
- generic Java parameter type.annotations
- parameter annotations.- Returns:
- new parameter model.
-
create
-
create
public static List<Parameter> create(Class concreteClass, Class declaringClass, Constructor<?> ctor, boolean keepEncoded) Create a list of parameter models for a given resource method handler injectable constructor.- Parameters:
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 totrue
to disable automatic decoding of all the constructor parameters. (SeeEncoded
.- Returns:
- a list of constructor parameter models.
-
create
public static List<Parameter> create(Class concreteClass, Class declaringClass, 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.- Parameters:
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 totrue
to disable automatic decoding of all the method parameters. (SeeEncoded
.- Returns:
- a list of handling method parameter models.
-
overrideSource
Create new parameter model by overridingsource
of the original parameter model.- Parameters:
original
- original parameter model.source
- new overriding parameter source.- Returns:
- source-overridden copy of the original parameter.
-
getValue
-
getSourceAnnotation
Get the parameter source annotation.- Returns:
- parameter source annotation.
-
getSource
Get the parameter value source type.- Returns:
- parameter value source type.
-
getSourceName
Get the parameter source name, i.e. value of the parameter source annotation.- Returns:
- parameter source name.
-
isEncoded
public boolean isEncoded()Iftrue
, the injected parameter value should remain encoded.- Returns:
true
if the parameter value should remain encoded,false
otherwise.
-
hasDefaultValue
public boolean hasDefaultValue()Check if the parameter has a default value set.- Returns:
true
if the default parameter value has been set,false
otherwise.
-
getDefaultValue
Get the default parameter value.- Returns:
- default parameter value or
null
if no default value has been set for the parameter.
-
getRawType
Get raw type information for the parameter.- Returns:
- raw parameter type information.
-
getType
Get generic type information for the parameter.- Returns:
- generic parameter type information.
-
isQualified
public boolean isQualified()Check if the parameter isqualified
.- Returns:
true
if the parameter is qualified,false
otherwise.
-
isAnnotationPresent
- Specified by:
isAnnotationPresent
in interfaceAnnotatedElement
-
getAnnotation
- Specified by:
getAnnotation
in interfaceAnnotatedElement
-
getAnnotations
- Specified by:
getAnnotations
in interfaceAnnotatedElement
-
getDeclaredAnnotations
- Specified by:
getDeclaredAnnotations
in interfaceAnnotatedElement
-
toString
-
equals
-
hashCode
public int hashCode()
-