Class LocalParameterMap
java.lang.Object
org.springframework.webflow.core.collection.LocalParameterMap
- All Implemented Interfaces:
Serializable,org.springframework.binding.collection.MapAdaptable<String,,Object> ParameterMap
- Direct Known Subclasses:
MockParameterMap
An immutable parameter map storing String-keyed, String-valued parameters in a backing
Map implementation.
This base provides convenient operations for accessing parameters in a typed-manner.- Author:
- Keith Donald
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionLocalParameterMap(Map<String, Object> parameters) Creates a new parameter map from the provided map.LocalParameterMap(Map<String, Object> parameters, org.springframework.binding.convert.ConversionService conversionService) Creates a new parameter map from the provided map. -
Method Summary
Modifier and TypeMethodDescriptionAdapts this parameter map to anAttributeMap.asMap()booleanDoes the parameter with the provided name exist in this map?booleanGet a parameter value, returningnullif no value is found.<T> TGet a parameter value, converting it fromStringto the target type.<T> TGet a parameter value, converting it fromStringto the target type or returning the defaultValue if not found.Get a parameter value, returning the defaultValue if no value is found.String[]Get a multi-valued parameter value, returningnullif no value is found.<T> T[]Get a multi-valued parameter value, converting each value to the target type or returningnullif no value is found.getBoolean(String parameterName) Returns a boolean parameter value in the map, returningnullif no value was found.getBoolean(String parameterName, Boolean defaultValue) Returns a boolean parameter value in the map, returning the defaultValue if no value was found.getInteger(String parameterName) Returns an integer parameter value in the map, returningnullif no value was found.getInteger(String parameterName, Integer defaultValue) Returns an integer parameter value in the map, returning the defaultValue if no value was found.Returns a long parameter value in the map, returningnullif no value was found.Returns a long parameter value in the map, returning the defaultValue if no value was found.Returns the wrapped, modifiable map implementation.org.springframework.web.multipart.MultipartFilegetMultipartFile(String parameterName) Get a multi-part file parameter value, returningnullif no value is found.<T extends Number>
TReturns a number parameter value in the map that is of the specified type, returningnullif no value was found.<T extends Number>
TReturns a number parameter value in the map of the specified type, returning the defaultValue if no value was found.getRequired(String parameterName) Get the value of a required parameter.<T> TgetRequired(String parameterName, Class<T> targetType) Get the value of a required parameter and convert it to the target type.String[]getRequiredArray(String parameterName) Get a required multi-valued parameter value.<T> T[]getRequiredArray(String parameterName, Class<T> targetElementType) Get a required multi-valued parameter value, converting each value to the target type.getRequiredBoolean(String parameterName) Returns a boolean parameter value in the map, throwing an exception if the parameter is not present or could not be converted.getRequiredInteger(String parameterName) Returns an integer parameter value in the map, throwing an exception if the parameter is not present or could not be converted.getRequiredLong(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.MultipartFilegetRequiredMultipartFile(String parameterName) Get the value of a required multipart file parameter.<T extends Number>
TgetRequiredNumber(String parameterName, 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.inthashCode()protected voidinitParameters(Map<String, Object> parameters) Initializes this parameter map.booleanisEmpty()Is this parameter map empty, with a size of 0?intsize()Returns the number of parameters in this map.toString()
-
Constructor Details
-
LocalParameterMap
Creates a new parameter map from the provided map.It is expected that the contents of the backing map adhere to the parameter map contract; that is, map entries have string keys, string values, and remain unmodifiable.
- Parameters:
parameters- the contents of this parameter map
-
LocalParameterMap
public LocalParameterMap(Map<String, Object> parameters, org.springframework.binding.convert.ConversionService conversionService) Creates a new parameter map from the provided map.It is expected that the contents of the backing map adhere to the parameter map contract; that is, map entries have string keys, string values, and remain unmodifiable.
- Parameters:
parameters- the contents of this parameter mapconversionService- a helper for performing type conversion of map entry values
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
asMap
-
isEmpty
public boolean isEmpty()Description copied from interface:ParameterMapIs this parameter map empty, with a size of 0?- Specified by:
isEmptyin interfaceParameterMap- Returns:
- true if empty, false if not
-
size
public int size()Description copied from interface:ParameterMapReturns the number of parameters in this map.- Specified by:
sizein interfaceParameterMap- Returns:
- the parameter count
-
contains
Description copied from interface:ParameterMapDoes the parameter with the provided name exist in this map?- Specified by:
containsin interfaceParameterMap- Parameters:
parameterName- the parameter name- Returns:
- true if so, false otherwise
-
get
Description copied from interface:ParameterMapGet a parameter value, returningnullif no value is found.- Specified by:
getin interfaceParameterMap- Parameters:
parameterName- the parameter name- Returns:
- the parameter value
-
get
Description copied from interface:ParameterMapGet a parameter value, returning the defaultValue if no value is found.- Specified by:
getin interfaceParameterMap- Parameters:
parameterName- the parameter namedefaultValue- the default- Returns:
- the parameter value
-
getArray
Description copied from interface:ParameterMapGet a multi-valued parameter value, returningnullif no value is found. If the parameter is single valued an array with a single element is returned.- Specified by:
getArrayin interfaceParameterMap- Parameters:
parameterName- the parameter name- Returns:
- the parameter value array
-
getArray
public <T> T[] getArray(String parameterName, Class<T> targetElementType) throws org.springframework.binding.convert.ConversionExecutionException Description copied from interface:ParameterMapGet a multi-valued parameter value, converting each value to the target type or returningnullif no value is found.- Specified by:
getArrayin interfaceParameterMap- Parameters:
parameterName- the parameter nametargetElementType- the target type of the array's elements- Returns:
- the converterd parameter value array
- Throws:
org.springframework.binding.convert.ConversionExecutionException- when the value could not be converted
-
get
public <T> T get(String parameterName, Class<T> targetType) throws org.springframework.binding.convert.ConversionExecutionException Description copied from interface:ParameterMapGet a parameter value, converting it fromStringto the target type.- Specified by:
getin interfaceParameterMap- Parameters:
parameterName- the name of the parametertargetType- the target type of the parameter value- Returns:
- the converted parameter value, or null if not found
- Throws:
org.springframework.binding.convert.ConversionExecutionException- when the value could not be converted
-
get
public <T> T get(String parameterName, Class<T> targetType, T defaultValue) throws org.springframework.binding.convert.ConversionExecutionException Description copied from interface:ParameterMapGet a parameter value, converting it fromStringto the target type or returning the defaultValue if not found.- Specified by:
getin interfaceParameterMap- Parameters:
parameterName- name of the parameter to gettargetType- the target type of the parameter valuedefaultValue- the default value- Returns:
- the converted parameter value, or the default if not found
- Throws:
org.springframework.binding.convert.ConversionExecutionException- when a value could not be converted
-
getRequired
Description copied from interface:ParameterMapGet the value of a required parameter.- Specified by:
getRequiredin interfaceParameterMap- Parameters:
parameterName- the name of the parameter- Returns:
- the parameter value
- Throws:
IllegalArgumentException- when the parameter is not found
-
getRequiredArray
Description copied from interface:ParameterMapGet a required multi-valued parameter value.- Specified by:
getRequiredArrayin interfaceParameterMap- Parameters:
parameterName- the name of the parameter- Returns:
- the parameter value
- Throws:
IllegalArgumentException- when the parameter is not found
-
getRequiredArray
public <T> T[] getRequiredArray(String parameterName, Class<T> targetElementType) throws IllegalArgumentException, org.springframework.binding.convert.ConversionExecutionException Description copied from interface:ParameterMapGet a required multi-valued parameter value, converting each value to the target type.- Specified by:
getRequiredArrayin interfaceParameterMap- Parameters:
parameterName- the name of the parameter- Returns:
- the parameter value
- Throws:
IllegalArgumentException- when the parameter is not foundorg.springframework.binding.convert.ConversionExecutionException- when a value could not be converted
-
getRequired
public <T> T getRequired(String parameterName, Class<T> targetType) throws IllegalArgumentException, org.springframework.binding.convert.ConversionExecutionException Description copied from interface:ParameterMapGet the value of a required parameter and convert it to the target type.- Specified by:
getRequiredin interfaceParameterMap- Parameters:
parameterName- the name of the parametertargetType- the target type of the parameter value- Returns:
- the converted parameter value
- Throws:
IllegalArgumentException- when the parameter is not foundorg.springframework.binding.convert.ConversionExecutionException- when the value could not be converted
-
getNumber
public <T extends Number> T getNumber(String parameterName, Class<T> targetType) throws org.springframework.binding.convert.ConversionExecutionException Description copied from interface:ParameterMapReturns a number parameter value in the map that is of the specified type, returningnullif no value was found.- Specified by:
getNumberin interfaceParameterMap- Parameters:
parameterName- the parameter nametargetType- the target number type- Returns:
- the number parameter value
- Throws:
org.springframework.binding.convert.ConversionExecutionException- when the value could not be converted
-
getNumber
public <T extends Number> T getNumber(String parameterName, Class<T> targetType, T defaultValue) throws org.springframework.binding.convert.ConversionExecutionException Description copied from interface:ParameterMapReturns a number parameter value in the map of the specified type, returning the defaultValue if no value was found.- Specified by:
getNumberin interfaceParameterMap- Parameters:
parameterName- the parameter namedefaultValue- the default- Returns:
- the number parameter value
- Throws:
org.springframework.binding.convert.ConversionExecutionException- when the value could not be converted
-
getRequiredNumber
public <T extends Number> T getRequiredNumber(String parameterName, Class<T> targetType) throws IllegalArgumentException, org.springframework.binding.convert.ConversionExecutionException Description copied from interface:ParameterMapReturns a number parameter value in the map, throwing an exception if the parameter is not present or could not be converted.- Specified by:
getRequiredNumberin interfaceParameterMap- Parameters:
parameterName- the parameter name- Returns:
- the number parameter value
- Throws:
IllegalArgumentException- if the parameter is not presentorg.springframework.binding.convert.ConversionExecutionException- when the value could not be converted
-
getInteger
public Integer getInteger(String parameterName) throws org.springframework.binding.convert.ConversionExecutionException Description copied from interface:ParameterMapReturns an integer parameter value in the map, returningnullif no value was found.- Specified by:
getIntegerin interfaceParameterMap- Parameters:
parameterName- the parameter name- Returns:
- the integer parameter value
- Throws:
org.springframework.binding.convert.ConversionExecutionException- when the value could not be converted
-
getInteger
public Integer getInteger(String parameterName, Integer defaultValue) throws org.springframework.binding.convert.ConversionExecutionException Description copied from interface:ParameterMapReturns an integer parameter value in the map, returning the defaultValue if no value was found.- Specified by:
getIntegerin interfaceParameterMap- Parameters:
parameterName- the parameter namedefaultValue- the default- Returns:
- the integer parameter value
- Throws:
org.springframework.binding.convert.ConversionExecutionException- when the value could not be converted
-
getRequiredInteger
public Integer getRequiredInteger(String parameterName) throws IllegalArgumentException, org.springframework.binding.convert.ConversionExecutionException Description copied from interface:ParameterMapReturns an integer parameter value in the map, throwing an exception if the parameter is not present or could not be converted.- Specified by:
getRequiredIntegerin interfaceParameterMap- Parameters:
parameterName- the parameter name- Returns:
- the integer parameter value
- Throws:
IllegalArgumentException- if the parameter is not presentorg.springframework.binding.convert.ConversionExecutionException- when the value could not be converted
-
getLong
public Long getLong(String parameterName) throws org.springframework.binding.convert.ConversionExecutionException Description copied from interface:ParameterMapReturns a long parameter value in the map, returningnullif no value was found.- Specified by:
getLongin interfaceParameterMap- Parameters:
parameterName- the parameter name- Returns:
- the long parameter value
- Throws:
org.springframework.binding.convert.ConversionExecutionException- when the value could not be converted
-
getLong
public Long getLong(String parameterName, Long defaultValue) throws org.springframework.binding.convert.ConversionExecutionException Description copied from interface:ParameterMapReturns a long parameter value in the map, returning the defaultValue if no value was found.- Specified by:
getLongin interfaceParameterMap- Parameters:
parameterName- the parameter namedefaultValue- the default- Returns:
- the long parameter value
- Throws:
org.springframework.binding.convert.ConversionExecutionException- when the value could not be converted
-
getRequiredLong
public Long getRequiredLong(String parameterName) throws IllegalArgumentException, org.springframework.binding.convert.ConversionExecutionException Description copied from interface:ParameterMapReturns a long parameter value in the map, throwing an exception if the parameter is not present or could not be converted.- Specified by:
getRequiredLongin interfaceParameterMap- Parameters:
parameterName- the parameter name- Returns:
- the long parameter value
- Throws:
IllegalArgumentException- if the parameter is not presentorg.springframework.binding.convert.ConversionExecutionException- when the value could not be converted
-
getBoolean
public Boolean getBoolean(String parameterName) throws org.springframework.binding.convert.ConversionExecutionException Description copied from interface:ParameterMapReturns a boolean parameter value in the map, returningnullif no value was found.- Specified by:
getBooleanin interfaceParameterMap- Parameters:
parameterName- the parameter name- Returns:
- the long parameter value
- Throws:
org.springframework.binding.convert.ConversionExecutionException- when the value could not be converted
-
getBoolean
public Boolean getBoolean(String parameterName, Boolean defaultValue) throws org.springframework.binding.convert.ConversionExecutionException Description copied from interface:ParameterMapReturns a boolean parameter value in the map, returning the defaultValue if no value was found.- Specified by:
getBooleanin interfaceParameterMap- Parameters:
parameterName- the parameter namedefaultValue- the default- Returns:
- the boolean parameter value
- Throws:
org.springframework.binding.convert.ConversionExecutionException- when the value could not be converted
-
getRequiredBoolean
public Boolean getRequiredBoolean(String parameterName) throws IllegalArgumentException, org.springframework.binding.convert.ConversionExecutionException Description copied from interface:ParameterMapReturns a boolean parameter value in the map, throwing an exception if the parameter is not present or could not be converted.- Specified by:
getRequiredBooleanin interfaceParameterMap- Parameters:
parameterName- the parameter name- Returns:
- the boolean parameter value
- Throws:
IllegalArgumentException- if the parameter is not presentorg.springframework.binding.convert.ConversionExecutionException- when the value could not be converted
-
getMultipartFile
Description copied from interface:ParameterMapGet a multi-part file parameter value, returningnullif no value is found.- Specified by:
getMultipartFilein interfaceParameterMap- Parameters:
parameterName- the parameter name- Returns:
- the multipart file
-
getRequiredMultipartFile
public org.springframework.web.multipart.MultipartFile getRequiredMultipartFile(String parameterName) throws IllegalArgumentException Description copied from interface:ParameterMapGet the value of a required multipart file parameter.- Specified by:
getRequiredMultipartFilein interfaceParameterMap- Parameters:
parameterName- the name of the parameter- Returns:
- the parameter value
- Throws:
IllegalArgumentException- when the parameter is not found
-
asAttributeMap
Description copied from interface:ParameterMapAdapts this parameter map to anAttributeMap.- Specified by:
asAttributeMapin interfaceParameterMap- Returns:
- the underlying map as a unmodifiable attribute map
-
initParameters
Initializes this parameter map.- Parameters:
parameters- the parameters
-
getMapInternal
Returns the wrapped, modifiable map implementation. -
toString
-