Class StringCollectionExtractor
java.lang.Object
org.glassfish.jersey.server.internal.inject.StringCollectionExtractor
- All Implemented Interfaces:
MultivaluedParameterExtractor<Collection<String>>
- Direct Known Subclasses:
StringCollectionExtractor.ListString
,StringCollectionExtractor.SetString
,StringCollectionExtractor.SortedSetString
abstract class StringCollectionExtractor
extends Object
implements MultivaluedParameterExtractor<Collection<String>>
Extract parameter value as a specific
String
Java collection type.
This class can be seen as a special, optimized, case of CollectionExtractor
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
private static final class
private static final class
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
StringCollectionExtractor
(String parameterName, String defaultValue) Create new string collection parameter 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
.static StringCollectionExtractor
getInstance
(Class<?> collectionType, String parameterName, String defaultValue) Get string collection extractor instance supporting the given collection class type for the parameter specified.getName()
Name of the parameter (map key) to be extracted from the suppliedmultivalued map
.protected abstract Collection<String>
Get a new string collection instance that will be used to store the extracted parameters.
-
Field Details
-
parameter
-
defaultValue
-
-
Constructor Details
-
StringCollectionExtractor
Create new string collection parameter extractor.- Parameters:
parameterName
- parameter name.defaultValue
- default parameter 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<Collection<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<Collection<String>>
- Returns:
- default (back-up) map entry value.
-
extract
Description copied from interface:MultivaluedParameterExtractor
Extract the map entry identified by aname
(and using the configureddefault value
) from the suppliedmultivalued map
.- Specified by:
extract
in interfaceMultivaluedParameterExtractor<Collection<String>>
- Parameters:
parameters
- multivalued parameter map.- Returns:
- custom Java type instance representing the extracted multivalued map entry.
-
newCollection
Get a new string collection instance that will be used to store the extracted parameters. The method is overridden by concrete implementations to return an instance of a proper collection sub-type.- Returns:
- instance of a proper collection sub-type
-
getInstance
public static StringCollectionExtractor getInstance(Class<?> collectionType, String parameterName, String defaultValue) Get string collection extractor instance supporting the given collection class type for the parameter specified.- Parameters:
collectionType
- collection type to be supported by the extractor.parameterName
- extracted parameter name.defaultValue
- default parameter value.- Returns:
- string collection extractor instance supporting the given collection class type.
-