Package org.glassfish.jersey.model
Class Parameter
- java.lang.Object
-
- org.glassfish.jersey.model.Parameter
-
- All Implemented Interfaces:
AnnotatedElement
- Direct Known Subclasses:
Parameter
public class Parameter extends Object implements AnnotatedElement
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceParameter.ParamAnnotationHelper<T extends Annotation>static interfaceParameter.ParamCreationFactory<PARAMETER extends Parameter>A factory service to found in a runtime to be used to instantiate the givenParameterclass.static classParameter.ParameterServicestatic classParameter.SourceParameter injection sources type.
-
Constructor Summary
Constructors Modifier Constructor Description protectedParameter(Annotation[] markers, Annotation marker, Parameter.Source source, String sourceName, Class<?> rawType, Type type, boolean encoded, String defaultValue)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <PARAMETER extends Parameter>
PARAMETERcreate(Class concreteClass, Class declaringClass, boolean encodeByDefault, Class<?> rawType, Type type, Annotation[] annotations)Create a parameter model.protected static <PARAMETER extends Parameter>
PARAMETERcreate(Class concreteClass, Class declaringClass, boolean encodeByDefault, Class<?> rawType, Type type, Annotation[] annotations, Class<?> parameterClass)Create a parameter model.static <PARAMETER extends Parameter>
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.protected static <PARAMETER extends Parameter>
List<PARAMETER>createList(Class concreteClass, Class declaringClass, Constructor<?> ctor, boolean keepEncoded, Class<?> parameterClass)Create a list of parameter models for a given resource method handler injectable constructor.protected static <PARAMETER extends Parameter>
List<PARAMETER>createList(Class concreteClass, Class declaringClass, Method javaMethod, boolean keepEncoded, Class parameterClass)Create a list of parameter models for a given Java method handling a resource method, sub-resource method or a sub-resource locator.booleanequals(Object o)<T extends Annotation>
TgetAnnotation(Class<T> annotationClass)Annotation[]getAnnotations()Annotation[]getDeclaredAnnotations()StringgetDefaultValue()Get the default parameter value.Class<?>getRawType()Get raw type information for the parameter.Parameter.SourcegetSource()Get the parameter value source type.AnnotationgetSourceAnnotation()Get the parameter source annotation.StringgetSourceName()Get the parameter source name, i.e.TypegetType()Get generic type information for the parameter.booleanhasDefaultValue()Check if the parameter has a default value set.inthashCode()booleanisAnnotationPresent(Class<? extends Annotation> annotationClass)booleanisEncoded()Iftrue, the injected parameter value should remain encoded.booleanisQualified()Check if the parameter is qualified.StringtoString()-
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
-
-
-
-
Constructor Detail
-
Parameter
protected Parameter(Annotation[] markers, Annotation marker, Parameter.Source source, String sourceName, Class<?> rawType, Type type, boolean encoded, String defaultValue)
-
-
Method Detail
-
create
public static <PARAMETER extends Parameter> 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 ofEncodedannotation in the list of the parameterannotationswill 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
protected static <PARAMETER extends Parameter> PARAMETER create(Class concreteClass, Class declaringClass, boolean encodeByDefault, Class<?> rawType, Type type, Annotation[] annotations, Class<?> parameterClass)
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 ofEncodedannotation in the list of the parameterannotationswill override any value set in the flag totrue.rawType- raw Java parameter type.type- generic Java parameter type.annotations- parameter annotations.parameterClass- class of the parameter to be used byParameter.ParamCreationFactory- Returns:
- new parameter model.
-
create
public static <PARAMETER extends Parameter> 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 totrueto disable automatic decoding of all the method parameters. (SeeEncoded.- Returns:
- a list of handling method parameter models.
-
createList
protected static <PARAMETER extends Parameter> List<PARAMETER> createList(Class concreteClass, Class declaringClass, Method javaMethod, boolean keepEncoded, Class parameterClass)
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 totrueto disable automatic decoding of all the method parameters. (SeeEncoded.parameterClass- Class of a Parameter in returned list- Returns:
- a list of handling method parameter models.
-
createList
protected static <PARAMETER extends Parameter> List<PARAMETER> createList(Class concreteClass, Class declaringClass, Constructor<?> ctor, boolean keepEncoded, Class<?> parameterClass)
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 totrueto disable automatic decoding of all the constructor parameters. (SeeEncoded.- Returns:
- a list of constructor parameter models.
-
getSourceAnnotation
public Annotation getSourceAnnotation()
Get the parameter source annotation.- Returns:
- parameter source annotation.
-
getSource
public Parameter.Source getSource()
Get the parameter value source type.- Returns:
- parameter value source type.
-
getSourceName
public String 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:
trueif the parameter value should remain encoded,falseotherwise.
-
hasDefaultValue
public boolean hasDefaultValue()
Check if the parameter has a default value set.- Returns:
trueif the default parameter value has been set,falseotherwise.
-
getDefaultValue
public String getDefaultValue()
Get the default parameter value.- Returns:
- default parameter value or
nullif no default value has been set for the parameter.
-
getRawType
public Class<?> getRawType()
Get raw type information for the parameter.- Returns:
- raw parameter type information.
-
getType
public Type getType()
Get generic type information for the parameter.- Returns:
- generic parameter type information.
-
isQualified
public boolean isQualified()
Check if the parameter is qualified.- Returns:
false.
-
isAnnotationPresent
public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
- Specified by:
isAnnotationPresentin interfaceAnnotatedElement
-
getAnnotation
public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
- Specified by:
getAnnotationin interfaceAnnotatedElement
-
getAnnotations
public Annotation[] getAnnotations()
- Specified by:
getAnnotationsin interfaceAnnotatedElement
-
getDeclaredAnnotations
public Annotation[] getDeclaredAnnotations()
- Specified by:
getDeclaredAnnotationsin interfaceAnnotatedElement
-
-