| java.lang.Object java.beans.PropertyEditorSupport org.springframework.beans.propertyeditors.CustomMapEditor
Constructor Summary | |
public | CustomMapEditor(Class mapType) Create a new CustomMapEditor for the given target type,
keeping an incoming null as-is. | public | CustomMapEditor(Class mapType, boolean nullAsEmptyMap) Create a new CustomMapEditor for the given target type. |
Method Summary | |
protected boolean | alwaysCreateNewMap() Return whether to always create a new Map,
even if the type of the passed-in Map already matches. | protected Object | convertKey(Object key) Hook to convert each encountered Map key.
The default implementation simply returns the passed-in key as-is.
Can be overridden to perform conversion of certain keys,
for example from String to Integer.
Only called if actually creating a new Map!
This is by default not the case if the type of the passed-in Map
already matches. | protected Object | convertValue(Object value) Hook to convert each encountered Map value.
The default implementation simply returns the passed-in value as-is.
Can be overridden to perform conversion of certain values,
for example from String to Integer.
Only called if actually creating a new Map!
This is by default not the case if the type of the passed-in Map
already matches. | protected Map | createMap(Class mapType, int initialCapacity) Create a Map of the given type, with the given
initial capacity (if supported by the Map type). | public String | getAsText() This implementation returns null to indicate that
there is no appropriate text representation. | public void | setAsText(String text) Convert the given text value to a Map with a single element. | public void | setValue(Object value) Convert the given value to a Map of the target type. |
CustomMapEditor | public CustomMapEditor(Class mapType, boolean nullAsEmptyMap)(Code) | | Create a new CustomMapEditor for the given target type.
If the incoming value is of the given type, it will be used as-is.
If it is a different Map type or an array, it will be converted
to a default implementation of the given Map type.
If the value is anything else, a target Map with that single
value will be created.
The default Map implementations are: ArrayList for List,
TreeSet for SortedSet, and LinkedHashSet or HashSet for Set.
Parameters: mapType - the target type, which needs to be asub-interface of Map or a concrete Map class Parameters: nullAsEmptyMap - ap whether to convert an incoming null value to an empty Map (of the appropriate type) See Also: java.util.Map See Also: java.util.HashMap See Also: java.util.TreeMap See Also: org.springframework.core.CollectionFactory.createLinkedMapIfPossible |
alwaysCreateNewMap | protected boolean alwaysCreateNewMap()(Code) | | Return whether to always create a new Map,
even if the type of the passed-in Map already matches.
Default is "false"; can be overridden to enforce creation of a
new Map, for example to convert elements in any case.
See Also: CustomMapEditor.convertKey See Also: CustomMapEditor.convertValue |
convertKey | protected Object convertKey(Object key)(Code) | | Hook to convert each encountered Map key.
The default implementation simply returns the passed-in key as-is.
Can be overridden to perform conversion of certain keys,
for example from String to Integer.
Only called if actually creating a new Map!
This is by default not the case if the type of the passed-in Map
already matches. Override
CustomMapEditor.alwaysCreateNewMap() to
enforce creating a new Map in every case.
Parameters: key - the source key the key to be used in the target Map See Also: CustomMapEditor.alwaysCreateNewMap |
convertValue | protected Object convertValue(Object value)(Code) | | Hook to convert each encountered Map value.
The default implementation simply returns the passed-in value as-is.
Can be overridden to perform conversion of certain values,
for example from String to Integer.
Only called if actually creating a new Map!
This is by default not the case if the type of the passed-in Map
already matches. Override
CustomMapEditor.alwaysCreateNewMap() to
enforce creating a new Map in every case.
Parameters: value - the source value the value to be used in the target Map See Also: CustomMapEditor.alwaysCreateNewMap |
createMap | protected Map createMap(Class mapType, int initialCapacity)(Code) | | Create a Map of the given type, with the given
initial capacity (if supported by the Map type).
Parameters: mapType - a sub-interface of Map Parameters: initialCapacity - the initial capacity the new Map instance |
getAsText | public String getAsText()(Code) | | This implementation returns null to indicate that
there is no appropriate text representation.
|
setValue | public void setValue(Object value)(Code) | | Convert the given value to a Map of the target type.
|
|
|