Class StringCollectionExtractor
- java.lang.Object
-
- org.glassfish.jersey.server.internal.inject.StringCollectionExtractor
-
- All Implemented Interfaces:
MultivaluedParameterExtractor<java.util.Collection<java.lang.String>>
- Direct Known Subclasses:
StringCollectionExtractor.ListString,StringCollectionExtractor.SetString,StringCollectionExtractor.SortedSetString
abstract class StringCollectionExtractor extends java.lang.Object implements MultivaluedParameterExtractor<java.util.Collection<java.lang.String>>
Extract parameter value as a specificStringJava collection type. This class can be seen as a special, optimized, case ofCollectionExtractor.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classStringCollectionExtractor.ListStringprivate static classStringCollectionExtractor.SetStringprivate static classStringCollectionExtractor.SortedSetString
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringdefaultValueprivate java.lang.Stringparameter
-
Constructor Summary
Constructors Modifier Constructor Description protectedStringCollectionExtractor(java.lang.String parameterName, java.lang.String defaultValue)Create new string collection parameter extractor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.util.Collection<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.StringgetDefaultValueString()Default entry value (string) that will be used in case the entry is not present in the suppliedmultivalued map.static StringCollectionExtractorgetInstance(java.lang.Class<?> collectionType, java.lang.String parameterName, java.lang.String defaultValue)Get string collection extractor instance supporting the given collection class type for the parameter specified.java.lang.StringgetName()Name of the parameter (map key) to be extracted from the suppliedmultivalued map.protected abstract java.util.Collection<java.lang.String>newCollection()Get a new string collection instance that will be used to store the extracted parameters.
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:MultivaluedParameterExtractorName of the parameter (map key) to be extracted from the suppliedmultivalued map.- Specified by:
getNamein interfaceMultivaluedParameterExtractor<java.util.Collection<java.lang.String>>- Returns:
- name of the extracted parameter.
-
getDefaultValueString
public java.lang.String getDefaultValueString()
Description copied from interface:MultivaluedParameterExtractorDefault entry value (string) that will be used in case the entry is not present in the suppliedmultivalued map.- Specified by:
getDefaultValueStringin interfaceMultivaluedParameterExtractor<java.util.Collection<java.lang.String>>- Returns:
- default (back-up) map entry value.
-
extract
public java.util.Collection<java.lang.String> extract(javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> parameters)
Description copied from interface:MultivaluedParameterExtractorExtract the map entry identified by aname(and using the configureddefault value) from the suppliedmultivalued map.- Specified by:
extractin interfaceMultivaluedParameterExtractor<java.util.Collection<java.lang.String>>- Parameters:
parameters- multivalued parameter map.- Returns:
- custom Java type instance representing the extracted multivalued map entry.
-
newCollection
protected abstract java.util.Collection<java.lang.String> 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(java.lang.Class<?> collectionType, java.lang.String parameterName, java.lang.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.
-
-