E
- enumeration classpublic class EnumCodec<E extends Enum<E>> extends Object
StringSetCodec
behind the scenes to do the mapping, but provides methods in terms
of the enumeration constants.StringSetCodec
,
CodecFactory
Modifier and Type | Method and Description |
---|---|
E |
decode(String encoding)
Returns the enum constant mapped to the given encoding.
|
<T extends Enum<T>> |
encode(T constant)
Returns the encoding for the given constant.
|
int |
size()
Returns the number of mappings in this codec, that is, the
number of constants in the enumeration class.
|
String |
toDebugString()
Returns a string representation of the codec, useful for
debugging.
|
public <T extends Enum<T>> String encode(T constant)
T
- enumeration classconstant
- the constantpublic E decode(String encoding)
encoding
- the encodingpublic int size()
public String toDebugString()
Copyright © 2016. All Rights Reserved.