java.util.Map , java.util.SortedMap
| Modifier and Type | Field and Description |
|---|---|
| private final Class | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| public | CustomMapEditor(Class<? extends Map<K, V>>
the target type, which needs to be a
sub-interface of Map or a concrete Map class mapType)Create a new CustomMapEditor for the given target type,
keeping an incoming |
| public | CustomMapEditor(Class<? extends Map<K, V>>
the target type, which needs to be a
sub-interface of Map or a concrete Map class mapType, boolean ap whether to convert an incoming nullAsEmptyMap)null
value to an empty Map (of the appropriate type)Create a new CustomMapEditor for the given target type. |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | alwaysCreateNewMap()
Return whether to always create a new Map, even if the type of the passed-in Map already matches. |
| protected Object | Returns: the key to be used in the target Mapthe source key key)Hook to convert each encountered Map key. |
| protected Object | Returns: the value to be used in the target Mapthe source value value)Hook to convert each encountered Map value. |
| protected Map | |
| public String | getAsText()
Overrides java. Implements java. This implementation returns |
| public void | setAsText(String
The string to be parsed. text)Overrides java. Implements java. Convert the given text value to a Map with a single element. |
| public void | setValue(Object
The new target object to be edited. Note that this
object should not be modified by the PropertyEditor, rather
the PropertyEditor should create a new object to hold any
modified value. value)Overrides java. Implements java. Convert the given value to a Map of the target type. |
| mapType | back to summary |
|---|---|
private final Class<? extends Map<K, V>> mapType
| |
| nullAsEmptyMap | back to summary |
|---|---|
| private final boolean nullAsEmptyMap | |
| CustomMapEditor | back to summary |
|---|---|
| public CustomMapEditor(Class<? extends Map<K, V>> mapType) Create a new CustomMapEditor for the given target type,
keeping an incoming
| |
| CustomMapEditor | back to summary |
|---|---|
| public CustomMapEditor(Class<? extends Map<K, V>> mapType, boolean nullAsEmptyMap) 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: TreeMap for SortedMap, and LinkedHashMap for Map.
| |
| alwaysCreateNewMap | back to summary |
|---|---|
| protected boolean alwaysCreateNewMap() 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.
| |
| convertKey | back to summary |
|---|---|
| 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. Override
| |
| convertValue | back to summary |
|---|---|
| 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. Override
| |
| createMap | back to summary |
|---|---|
| protected Map Create a Map of the given type, with the given initial capacity (if supported by the Map type). | |
| getAsText | back to summary |
|---|---|
| public String getAsText() Overrides java. Implements java. This implementation returns
| |
| setAsText | back to summary |
|---|---|
| public void setAsText(String text) throws IllegalArgumentException Overrides java. Implements java. Convert the given text value to a Map with a single element.
| |
| setValue | back to summary |
|---|---|
| public void setValue(Object value) Overrides java. Implements java. Convert the given value to a Map of the target type.
| |