K
- The type of map keysV
- The type of map valuespublic final class MapConverter<K,V> extends SequenceConverter<Map<K,V>>
Converter
implementation for all JDK
java.util.Map
types.
All odd elements returned from tokenizer are map keys, all even elements are map values.
tokenizer
Modifier and Type | Method and Description |
---|---|
boolean |
appendMessageArguments(ValidationContext<?> context,
Map<String,Object> arguments)
Appends
kconverter and vconverter arguments
that contain converter of map keys and converter of map values
respectively. |
protected <T> Map<K,V> |
doDecode(String[] tokens,
ValidationContext<T> context,
List<MalformedValueException> violations)
Converts string representations of key-value pairs into map.
|
<T> String |
encode(Map<K,V> value,
ValidationContext<T> context)
Converts map into string representation of key-value pairs.
|
Class<Map<K,V>> |
getType()
Returns map type.
|
protected <T> String[] |
tokenize(String value,
ValidationContext<T> context)
Returns array of tokens extracted from the source string.
|
decode
getMessageTemplate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMessageTemplate
public boolean appendMessageArguments(ValidationContext<?> context, Map<String,Object> arguments)
kconverter
and vconverter
arguments
that contain converter of map keys and converter of map values
respectively.appendMessageArguments
in interface Converter<Map<K,V>>
appendMessageArguments
in interface Validation<Map<K,V>>
appendMessageArguments
in class SequenceConverter<Map<K,V>>
context
- Validation context.arguments
- Arguments to be substituted into the error message
template.true
.protected <T> Map<K,V> doDecode(String[] tokens, ValidationContext<T> context, List<MalformedValueException> violations)
doDecode
in class SequenceConverter<Map<K,V>>
T
- The type of validated entity.tokens
- String representations of key-value pairs.context
- Validation context.violations
- List of violations.MalformedValueException
- if conversion of key-value pairs fails.protected <T> String[] tokenize(String value, ValidationContext<T> context)
tokenize
in class SequenceConverter<Map<K,V>>
T
- The type of validated entity.value
- Source string to be tokenized.context
- Validation context.MalformedValueException
- if conversion fails.Tokenizer.decode(String, ValidationContext)
public <T> String encode(Map<K,V> value, ValidationContext<T> context)
T
- The type of validated entity.value
- Map to be encoded.context
- Validation context.Copyright © 2011–2020 FoxLabs. All rights reserved.