Class SingleStringValueExtractor
java.lang.Object
org.glassfish.jersey.server.internal.inject.SingleStringValueExtractor
- All Implemented Interfaces:
MultivaluedParameterExtractor<String>
final class SingleStringValueExtractor
extends Object
implements MultivaluedParameterExtractor<String>
Extract value of the parameter by returning the first string parameter value
found in the list of string parameter values.
This class can be seen as a special, optimized, case of
SingleValueExtractor
.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSingleStringValueExtractor
(String parameterName, String defaultValue) Create new single string value extractor. -
Method Summary
Modifier and TypeMethodDescriptionExtract the map entry identified by aname
(and using the configureddefault value
) from the suppliedmultivalued map
.Default entry value (string) that will be used in case the entry is not present in the suppliedmultivalued map
.getName()
Name of the parameter (map key) to be extracted from the suppliedmultivalued map
.
-
Field Details
-
paramName
-
defaultValue
-
-
Constructor Details
-
SingleStringValueExtractor
Create new single string value extractor.- Parameters:
parameterName
- string parameter name.defaultValue
- default value.
-
-
Method Details
-
getName
Description copied from interface:MultivaluedParameterExtractor
Name of the parameter (map key) to be extracted from the suppliedmultivalued map
.- Specified by:
getName
in interfaceMultivaluedParameterExtractor<String>
- Returns:
- name of the extracted parameter.
-
getDefaultValueString
Description copied from interface:MultivaluedParameterExtractor
Default entry value (string) that will be used in case the entry is not present in the suppliedmultivalued map
.- Specified by:
getDefaultValueString
in interfaceMultivaluedParameterExtractor<String>
- Returns:
- default (back-up) map entry value.
-
extract
Extract the map entry identified by aname
(and using the configureddefault value
) from the suppliedmultivalued map
. This implementation return s the first String value found in the list of potential multiple string parameter values. Any other values in the multi-value list will be ignored.- Specified by:
extract
in interfaceMultivaluedParameterExtractor<String>
- Parameters:
parameters
- map of parameters.- Returns:
- extracted single string parameter value.
-