Class ParameterList.AbstractParamGetter
- java.lang.Object
-
- org.restlet.ext.jaxrs.internal.wrappers.params.ParameterList.AbstractParamGetter
-
- All Implemented Interfaces:
ParameterList.ParamGetter
- Direct Known Subclasses:
ParameterList.EncParamGetter,ParameterList.NoEncParamGetter
- Enclosing class:
- ParameterList
abstract static class ParameterList.AbstractParamGetter extends java.lang.Object implements ParameterList.ParamGetter
Abstract super class for access to @*Param.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Class<java.util.Collection<?>>collTypeThe type of the collection.protected java.lang.Class<?>convertToThe class to convert to.protected javax.ws.rs.DefaultValuedefaultValueThe default value for this parameter (if given)protected booleanisArrayTrue, if this parameter should be an array, otherwise false.protected ThreadLocalizedContexttlContext
-
Constructor Summary
Constructors Constructor Description AbstractParamGetter(javax.ws.rs.DefaultValue defaultValue, java.lang.Class<?> convToCl, java.lang.reflect.Type convToGen, ThreadLocalizedContext tlContext)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.lang.ObjectconvertParamValue(java.lang.String firstHeader)protected java.lang.ObjectconvertParamValue(java.lang.String paramValue, javax.ws.rs.DefaultValue defaultValue)Converts the given paramValue (found in the path, query, matrix or header) into the given paramClass.private java.lang.ObjectconvertParamValueInner(java.lang.String paramValue, javax.ws.rs.DefaultValue defaultValue)Converts the given value without any decoding.protected java.lang.ObjectconvertParamValues(java.util.Iterator<java.lang.String> paramValueIter)private java.lang.ObjectconvertWithConverterUtils(java.lang.String paramValue)protected <A> java.util.Collection<A>createColl()protected abstract booleandecoding()abstract java.lang.ObjectgetParamValue()protected java.lang.ObjectgetParamValueForPrimitive(java.lang.String paramValue)java.lang.ObjectgetValue()Returns the value for this param.private voidhandleExceptionOnInvocation(java.lang.String value, java.lang.Exception e)protected <A> java.util.Collection<A>unmodifiable(java.util.Collection<A> coll)
-
-
-
Field Detail
-
collType
protected final java.lang.Class<java.util.Collection<?>> collType
The type of the collection. null, if this parameter do not represent a collection.
-
convertTo
protected final java.lang.Class<?> convertTo
The class to convert to. If this object getter represents an *Param annotated parameter, and it should be to an array or collection of something, this value contains not the collection/array type, but the generic type of it.
-
defaultValue
protected final javax.ws.rs.DefaultValue defaultValue
The default value for this parameter (if given)
-
isArray
protected final boolean isArray
True, if this parameter should be an array, otherwise false. If true, theParameterList.collType(java.lang.reflect.ParameterizedType)must be set to aList.
-
tlContext
protected final ThreadLocalizedContext tlContext
-
-
Constructor Detail
-
AbstractParamGetter
AbstractParamGetter(javax.ws.rs.DefaultValue defaultValue, java.lang.Class<?> convToCl, java.lang.reflect.Type convToGen, ThreadLocalizedContext tlContext)
-
-
Method Detail
-
convertParamValue
protected java.lang.Object convertParamValue(java.lang.String firstHeader) throws ConvertParameterException- Throws:
ConvertParameterException
-
convertParamValue
protected java.lang.Object convertParamValue(java.lang.String paramValue, javax.ws.rs.DefaultValue defaultValue) throws ConvertParameterExceptionConverts the given paramValue (found in the path, query, matrix or header) into the given paramClass.- Parameters:
paramValue-defaultValue-- Returns:
- Throws:
ConvertParameterException- See Also:
PathParam,MatrixParam,QueryParam,HeaderParam,CookieParam
-
convertParamValueInner
private java.lang.Object convertParamValueInner(java.lang.String paramValue, javax.ws.rs.DefaultValue defaultValue) throws ConvertParameterException, javax.ws.rs.WebApplicationExceptionConverts the given value without any decoding.- Parameters:
paramValue-defaultValue-- Returns:
- Throws:
ConvertParameterExceptionjavax.ws.rs.WebApplicationException- if the conversion method throws an WebApplicationException.
-
convertParamValues
protected java.lang.Object convertParamValues(java.util.Iterator<java.lang.String> paramValueIter) throws ConvertParameterException- Throws:
ConvertParameterException
-
convertWithConverterUtils
private java.lang.Object convertWithConverterUtils(java.lang.String paramValue)
-
createColl
protected <A> java.util.Collection<A> createColl()
- Returns:
- an new created instance of
ParameterList.collType(java.lang.reflect.ParameterizedType). Returns null, if collType is null.
-
decoding
protected abstract boolean decoding()
-
getParamValue
public abstract java.lang.Object getParamValue()
- Returns:
- the concrete value of this parameter for the current request.
-
getParamValueForPrimitive
protected java.lang.Object getParamValueForPrimitive(java.lang.String paramValue) throws ConvertParameterException- Throws:
ConvertParameterException
-
getValue
public java.lang.Object getValue()
Description copied from interface:ParameterList.ParamGetterReturns the value for this param.- Specified by:
getValuein interfaceParameterList.ParamGetter- Returns:
- the value for this param.
-
handleExceptionOnInvocation
private void handleExceptionOnInvocation(java.lang.String value, java.lang.Exception e) throws ConvertParameterException- Throws:
ConvertParameterException
-
unmodifiable
protected <A> java.util.Collection<A> unmodifiable(java.util.Collection<A> coll)
-
-