public abstract class Tokenizer extends AbstractConverter<String[]>
Converter
implementation for the
string array type. In other words, this class is a string tokenizer that
splits one string into array of strings and vice versa.Modifier and Type | Field and Description |
---|---|
static String[] |
EMPTY_TOKEN_ARRAY
Empty token array.
|
Constructor and Description |
---|
Tokenizer() |
Modifier and Type | Method and Description |
---|---|
<T> String[] |
decode(String value,
ValidationContext<T> context)
Returns array of tokens extracted from the source string.
|
<T> String |
encode(String[] value,
ValidationContext<T> context)
Builds string from the specified array of tokens.
|
Class<String[]> |
getType()
Returns string array type.
|
doDecode, doEncode
appendMessageArguments, getMessageTemplate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
appendMessageArguments, getMessageTemplate
public static final String[] EMPTY_TOKEN_ARRAY
public final Class<String[]> getType()
public <T> String[] decode(String value, ValidationContext<T> context)
Invokes AbstractConverter.doDecode(String, ValidationContext)
if source string
is not null
or empty; returns empty token array otherwise.
decode
in interface Converter<String[]>
decode
in class AbstractConverter<String[]>
T
- The type of validated entity.value
- Source string to be tokenized.context
- Validation context.MalformedValueException
- if conversion fails.AbstractConverter.doDecode(String, ValidationContext)
public <T> String encode(String[] value, ValidationContext<T> context)
Invokes AbstractConverter.doEncode(Object, ValidationContext)
if array of
tokens is not null
or empty; returns empty string otherwise.
encode
in interface Converter<String[]>
encode
in class AbstractConverter<String[]>
T
- The type of validated entity.value
- Array of tokens to be encoded.context
- Validation context.AbstractConverter.doEncode(Object, ValidationContext)
Copyright © 2011–2020 FoxLabs. All rights reserved.