Class SingleStringValueExtractor
- java.lang.Object
-
- org.glassfish.jersey.server.internal.inject.SingleStringValueExtractor
-
- All Implemented Interfaces:
MultivaluedParameterExtractor<java.lang.String>
final class SingleStringValueExtractor extends java.lang.Object implements MultivaluedParameterExtractor<java.lang.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 ofSingleValueExtractor
.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
defaultValue
private java.lang.String
paramName
-
Constructor Summary
Constructors Constructor Description SingleStringValueExtractor(java.lang.String parameterName, java.lang.String defaultValue)
Create new single string value extractor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
extract(javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> parameters)
Extract the map entry identified by aname
(and using the configureddefault value
) from the suppliedmultivalued map
.java.lang.String
getDefaultValueString()
Default entry value (string) that will be used in case the entry is not present in the suppliedmultivalued map
.java.lang.String
getName()
Name of the parameter (map key) to be extracted from the suppliedmultivalued map
.
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:MultivaluedParameterExtractor
Name of the parameter (map key) to be extracted from the suppliedmultivalued map
.- Specified by:
getName
in interfaceMultivaluedParameterExtractor<java.lang.String>
- Returns:
- name of the extracted parameter.
-
getDefaultValueString
public java.lang.String 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<java.lang.String>
- Returns:
- default (back-up) map entry value.
-
extract
public java.lang.String extract(javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> parameters)
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<java.lang.String>
- Parameters:
parameters
- map of parameters.- Returns:
- extracted single string parameter value.
-
-