Class AbstractParamValueExtractor<T>
java.lang.Object
org.glassfish.jersey.server.internal.inject.AbstractParamValueExtractor<T>
- Direct Known Subclasses:
CollectionExtractor, SingleValueExtractor
Abstract base class for implementing multivalued parameter value extractor
logic supplied using
parameter converters.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final UnsafeValue<T, RuntimeException> private final Stringprivate final javax.ws.rs.ext.ParamConverter<T> private final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractParamValueExtractor(javax.ws.rs.ext.ParamConverter<T> converter, String parameterName, String defaultValueString) Constructor that initializes common string reader-based parameter extractor data. -
Method Summary
Modifier and TypeMethodDescriptionprivate Tprotected final TGet converted default value.protected final TfromString(String value) Extract parameter value from string using the configuredparameter converter.Get the default string value of the parameter.getName()Get the name of the parameter this extractor belongs to.protected final booleanCheck if there is a default string value registered for the parameter.
-
Field Details
-
paramConverter
-
parameterName
-
defaultValueString
-
convertedDefaultValue
-
-
Constructor Details
-
AbstractParamValueExtractor
protected AbstractParamValueExtractor(javax.ws.rs.ext.ParamConverter<T> converter, String parameterName, String defaultValueString) Constructor that initializes common string reader-based parameter extractor data. As part of the initialization, the default value validation is performed based on the presence and value of theParamConverter.Lazyannotation on the supplied string value reader class.- Parameters:
converter- parameter converter.parameterName- name of the parameter.defaultValueString- default parameter value string.
-
-
Method Details
-
getName
Get the name of the parameter this extractor belongs to.- Returns:
- parameter name.
-
getDefaultValueString
Get the default string value of the parameter.- Returns:
- default parameter string value.
-
fromString
Extract parameter value from string using the configuredparameter converter. AWebApplicationExceptionthrown from the converter is propagated unchanged. Any other exception throws by the converter is wrapped in a newExtractorExceptionbefore rethrowing.- Parameters:
value- parameter string value to be converted/extracted.- Returns:
- extracted value of a given Java type.
- Throws:
javax.ws.rs.WebApplicationException- in case the underlying parameter converter throws aWebApplicationException. The exception is rethrown without a change.ExtractorException- wrapping any other exception thrown by the parameter converter.
-
convert
-
isDefaultValueRegistered
protected final boolean isDefaultValueRegistered()Check if there is a default string value registered for the parameter.- Returns:
trueif there is a default parameter string value registered,falseotherwise.
-
defaultValue
Get converted default value. The conversion happens lazily during first call of the method.- Returns:
- converted default value.
-