public interface ParameterMap extends MapAdaptable<java.lang.String,java.lang.Object>
The accessor methods offered by this class taking a target type argument only need to support conversions to well know types like String, Number subclasses, Boolean and so on.
Modifier and Type | Method and Description |
---|---|
AttributeMap<java.lang.Object> |
asAttributeMap()
Adapts this parameter map to an
AttributeMap . |
boolean |
contains(java.lang.String parameterName)
Does the parameter with the provided name exist in this map?
|
java.lang.String |
get(java.lang.String parameterName)
Get a parameter value, returning
null if no value is found. |
<T> T |
get(java.lang.String parameterName,
java.lang.Class<T> targetType)
Get a parameter value, converting it from
String to the target type. |
<T> T |
get(java.lang.String parameterName,
java.lang.Class<T> targetType,
T defaultValue)
Get a parameter value, converting it from
String to the target type or returning the defaultValue if
not found. |
java.lang.String |
get(java.lang.String parameterName,
java.lang.String defaultValue)
Get a parameter value, returning the defaultValue if no value is found.
|
java.lang.String[] |
getArray(java.lang.String parameterName)
Get a multi-valued parameter value, returning
null if no value is found. |
<T> T[] |
getArray(java.lang.String parameterName,
java.lang.Class<T> targetElementType)
Get a multi-valued parameter value, converting each value to the target type or returning
null if no
value is found. |
java.lang.Boolean |
getBoolean(java.lang.String parameterName)
Returns a boolean parameter value in the map, returning
null if no value was found. |
java.lang.Boolean |
getBoolean(java.lang.String parameterName,
java.lang.Boolean defaultValue)
Returns a boolean parameter value in the map, returning the defaultValue if no value was found.
|
java.lang.Integer |
getInteger(java.lang.String parameterName)
Returns an integer parameter value in the map, returning
null if no value was found. |
java.lang.Integer |
getInteger(java.lang.String parameterName,
java.lang.Integer defaultValue)
Returns an integer parameter value in the map, returning the defaultValue if no value was found.
|
java.lang.Long |
getLong(java.lang.String parameterName)
Returns a long parameter value in the map, returning
null if no value was found. |
java.lang.Long |
getLong(java.lang.String parameterName,
java.lang.Long defaultValue)
Returns a long parameter value in the map, returning the defaultValue if no value was found.
|
org.springframework.web.multipart.MultipartFile |
getMultipartFile(java.lang.String parameterName)
Get a multi-part file parameter value, returning
null if no value is found. |
<T extends java.lang.Number> |
getNumber(java.lang.String parameterName,
java.lang.Class<T> targetType)
Returns a number parameter value in the map that is of the specified type, returning
null if no
value was found. |
<T extends java.lang.Number> |
getNumber(java.lang.String parameterName,
java.lang.Class<T> targetType,
T defaultValue)
Returns a number parameter value in the map of the specified type, returning the defaultValue if no value was
found.
|
java.lang.String |
getRequired(java.lang.String parameterName)
Get the value of a required parameter.
|
<T> T |
getRequired(java.lang.String parameterName,
java.lang.Class<T> targetType)
Get the value of a required parameter and convert it to the target type.
|
java.lang.String[] |
getRequiredArray(java.lang.String parameterName)
Get a required multi-valued parameter value.
|
<T> T[] |
getRequiredArray(java.lang.String parameterName,
java.lang.Class<T> targetElementType)
Get a required multi-valued parameter value, converting each value to the target type.
|
java.lang.Boolean |
getRequiredBoolean(java.lang.String parameterName)
Returns a boolean parameter value in the map, throwing an exception if the parameter is not present or could not
be converted.
|
java.lang.Integer |
getRequiredInteger(java.lang.String parameterName)
Returns an integer parameter value in the map, throwing an exception if the parameter is not present or could not
be converted.
|
java.lang.Long |
getRequiredLong(java.lang.String parameterName)
Returns a long parameter value in the map, throwing an exception if the parameter is not present or could not be
converted.
|
org.springframework.web.multipart.MultipartFile |
getRequiredMultipartFile(java.lang.String parameterName)
Get the value of a required multipart file parameter.
|
<T extends java.lang.Number> |
getRequiredNumber(java.lang.String parameterName,
java.lang.Class<T> targetType)
Returns a number parameter value in the map, throwing an exception if the parameter is not present or could not
be converted.
|
boolean |
isEmpty()
Is this parameter map empty, with a size of 0?
|
int |
size()
Returns the number of parameters in this map.
|
asMap
boolean isEmpty()
int size()
boolean contains(java.lang.String parameterName)
parameterName
- the parameter namejava.lang.String get(java.lang.String parameterName)
null
if no value is found.parameterName
- the parameter namejava.lang.String get(java.lang.String parameterName, java.lang.String defaultValue)
parameterName
- the parameter namedefaultValue
- the defaultjava.lang.String[] getArray(java.lang.String parameterName)
null
if no value is found. If the parameter is single
valued an array with a single element is returned.parameterName
- the parameter name<T> T[] getArray(java.lang.String parameterName, java.lang.Class<T> targetElementType) throws ConversionExecutionException
null
if no
value is found.parameterName
- the parameter nametargetElementType
- the target type of the array's elementsConversionExecutionException
- when the value could not be converted<T> T get(java.lang.String parameterName, java.lang.Class<T> targetType) throws ConversionExecutionException
String
to the target type.parameterName
- the name of the parametertargetType
- the target type of the parameter valueConversionExecutionException
- when the value could not be converted<T> T get(java.lang.String parameterName, java.lang.Class<T> targetType, T defaultValue) throws ConversionExecutionException
String
to the target type or returning the defaultValue if
not found.parameterName
- name of the parameter to gettargetType
- the target type of the parameter valuedefaultValue
- the default valueConversionExecutionException
- when a value could not be convertedjava.lang.String getRequired(java.lang.String parameterName) throws java.lang.IllegalArgumentException
parameterName
- the name of the parameterjava.lang.IllegalArgumentException
- when the parameter is not foundjava.lang.String[] getRequiredArray(java.lang.String parameterName) throws java.lang.IllegalArgumentException
parameterName
- the name of the parameterjava.lang.IllegalArgumentException
- when the parameter is not found<T> T[] getRequiredArray(java.lang.String parameterName, java.lang.Class<T> targetElementType) throws java.lang.IllegalArgumentException, ConversionExecutionException
parameterName
- the name of the parameterjava.lang.IllegalArgumentException
- when the parameter is not foundConversionExecutionException
- when a value could not be converted<T> T getRequired(java.lang.String parameterName, java.lang.Class<T> targetType) throws java.lang.IllegalArgumentException, ConversionExecutionException
parameterName
- the name of the parametertargetType
- the target type of the parameter valuejava.lang.IllegalArgumentException
- when the parameter is not foundConversionExecutionException
- when the value could not be converted<T extends java.lang.Number> T getNumber(java.lang.String parameterName, java.lang.Class<T> targetType) throws ConversionExecutionException
null
if no
value was found.parameterName
- the parameter nametargetType
- the target number typeConversionExecutionException
- when the value could not be converted<T extends java.lang.Number> T getNumber(java.lang.String parameterName, java.lang.Class<T> targetType, T defaultValue) throws ConversionExecutionException
parameterName
- the parameter namedefaultValue
- the defaultConversionExecutionException
- when the value could not be converted<T extends java.lang.Number> T getRequiredNumber(java.lang.String parameterName, java.lang.Class<T> targetType) throws java.lang.IllegalArgumentException, ConversionExecutionException
parameterName
- the parameter namejava.lang.IllegalArgumentException
- if the parameter is not presentConversionExecutionException
- when the value could not be convertedjava.lang.Integer getInteger(java.lang.String parameterName) throws ConversionExecutionException
null
if no value was found.parameterName
- the parameter nameConversionExecutionException
- when the value could not be convertedjava.lang.Integer getInteger(java.lang.String parameterName, java.lang.Integer defaultValue) throws ConversionExecutionException
parameterName
- the parameter namedefaultValue
- the defaultConversionExecutionException
- when the value could not be convertedjava.lang.Integer getRequiredInteger(java.lang.String parameterName) throws java.lang.IllegalArgumentException, ConversionExecutionException
parameterName
- the parameter namejava.lang.IllegalArgumentException
- if the parameter is not presentConversionExecutionException
- when the value could not be convertedjava.lang.Long getLong(java.lang.String parameterName) throws ConversionExecutionException
null
if no value was found.parameterName
- the parameter nameConversionExecutionException
- when the value could not be convertedjava.lang.Long getLong(java.lang.String parameterName, java.lang.Long defaultValue) throws ConversionExecutionException
parameterName
- the parameter namedefaultValue
- the defaultConversionExecutionException
- when the value could not be convertedjava.lang.Long getRequiredLong(java.lang.String parameterName) throws java.lang.IllegalArgumentException, ConversionExecutionException
parameterName
- the parameter namejava.lang.IllegalArgumentException
- if the parameter is not presentConversionExecutionException
- when the value could not be convertedjava.lang.Boolean getBoolean(java.lang.String parameterName) throws ConversionExecutionException
null
if no value was found.parameterName
- the parameter nameConversionExecutionException
- when the value could not be convertedjava.lang.Boolean getBoolean(java.lang.String parameterName, java.lang.Boolean defaultValue) throws ConversionExecutionException
parameterName
- the parameter namedefaultValue
- the defaultConversionExecutionException
- when the value could not be convertedjava.lang.Boolean getRequiredBoolean(java.lang.String parameterName) throws java.lang.IllegalArgumentException, ConversionExecutionException
parameterName
- the parameter namejava.lang.IllegalArgumentException
- if the parameter is not presentConversionExecutionException
- when the value could not be convertedorg.springframework.web.multipart.MultipartFile getMultipartFile(java.lang.String parameterName)
null
if no value is found.parameterName
- the parameter nameorg.springframework.web.multipart.MultipartFile getRequiredMultipartFile(java.lang.String parameterName)
parameterName
- the name of the parameterjava.lang.IllegalArgumentException
- when the parameter is not foundAttributeMap<java.lang.Object> asAttributeMap()
AttributeMap
.