public interface EnumMarshaller<E extends Enum<E>> extends BaseMarshaller<E>
int
value that is
suitable for serializing with protobuf. The returned integer value must be one of the values defined in the .proto
file. The marshaller implementation must be stateless and thread-safe.Modifier and Type | Method and Description |
---|---|
E |
decode(int enumValue)
Decodes an integer enum value read from a protobuf encoded stream into a Java enum instance.
|
int |
encode(E e)
Encodes a Java enum into its corresponding protobuf numeric value.
|
getJavaClass, getTypeName
E decode(int enumValue)
null
in order to signal this to the library and allow the
unrecognized data to be preserved.enumValue
- the protobuf enum value to decodenull
otherwise.int encode(E e) throws IllegalArgumentException
e
- an Enum instanceIllegalArgumentException
- if the given Enum is of an unexpected type or its value has no correspondence to
a protobuf enum value (programming error).Copyright © 2017 JBoss, a division of Red Hat. All rights reserved.