V
- Enumeration typepublic final class EnumConverter<V extends Enum<V>> extends AbstractConverter<V>
Converter
implementation for all
java.lang.Enum
enumeration types.ConverterFactory.forEnum(Class, String)
Modifier and Type | Method and Description |
---|---|
boolean |
appendMessageArguments(ValidationContext<?> context,
Map<String,Object> arguments)
Appends
constants argument that contains set of allowed
enumeration constants. |
protected <T> V |
doDecode(String value,
ValidationContext<T> context)
Converts string representation of enumeration value into
java.lang.Enum object. |
protected <T> String |
doEncode(V value,
ValidationContext<T> context)
Converts
java.lang.Enum object into string representation. |
Class<V> |
getType()
Returns enumeration type.
|
decode, encode
getMessageTemplate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMessageTemplate
public boolean appendMessageArguments(ValidationContext<?> context, Map<String,Object> arguments)
constants
argument that contains set of allowed
enumeration constants.appendMessageArguments
in interface Converter<V extends Enum<V>>
appendMessageArguments
in interface Validation<V extends Enum<V>>
appendMessageArguments
in class AbstractValidation<V extends Enum<V>>
context
- Validation context.arguments
- Arguments to be substituted into the error message
template.true
.protected <T> V doDecode(String value, ValidationContext<T> context)
java.lang.Enum
object.doDecode
in class AbstractConverter<V extends Enum<V>>
T
- The type of validated entity.value
- String representation of enumeration value.context
- Validation context.java.lang.Enum
object.MalformedValueException
- if the specified string could not be
parsed as an enumeration constant.protected <T> String doEncode(V value, ValidationContext<T> context)
java.lang.Enum
object into string representation.doEncode
in class AbstractConverter<V extends Enum<V>>
T
- The type of validated entity.value
- java.lang.Enum
object to be encoded.context
- Validation context.Copyright © 2011–2020 FoxLabs. All rights reserved.