public final class EnumType extends DataType
java.lang.Enum instances.| Modifier and Type | Field and Description |
|---|---|
static int |
BYTES
An
enum requires 2 bytes for encoding. |
ADDRESS_TYPE, ARRAY_SUFFIX, CHARSET, CLASS_TYPE, EMPTY_STRING, FIELD_MASK_SIZE, INDENT, INDENT1, KEY_TYPE, MAX_ARRAY_SIZE, MAX_FIELDS, MAX_FILE_NAME_LENGTH, MAX_STRING_LENGTH, mBuiltinFlag, mClass, mDefaultValue, mSize, sClasses, sCompiledClasses, STRING_TYPE, VARIABLE_SIZE| Modifier and Type | Method and Description |
|---|---|
protected void |
createDeserializer(MessageType.MessageField field,
String fieldName,
String indent,
Formatter output,
boolean useBuilder)
Generates the code to de-serialize the enum instance
from a
ByteBuffer based on the enum ordinal value. |
protected void |
createSerializer(MessageType.MessageField field,
String fieldName,
String indent,
Formatter output)
Adds the Java code used to serialize the enum ordinal
value to a
ByteBuffer. |
Object |
deserialize(ByteBuffer buffer)
Returns the deserialized
Enum in
buffer. |
boolean |
isInstance(Object o)
Returns
true if o is a non-null
enum instance and false otherwise. |
void |
serialize(Object o,
ByteBuffer buffer)
Serializes this
Enum ordinal to the given
buffer. |
compareTo, dataClass, dataClassName, defaultValue, equals, fields, findCharset, findType, hashCode, isArray, isBuiltin, isEnum, isLocalOnly, isMessage, isPrimitive, replyClasses, size, toStringpublic static final int BYTES
enum requires 2 bytes for encoding.public boolean isInstance(Object o)
true if o is a non-null
enum instance and false otherwise.isInstance in class DataTypeo - Check this object's type.true if o is a non-null
enum instance and false otherwise.public void serialize(Object o, ByteBuffer buffer) throws BufferOverflowException
Enum ordinal to the given
buffer.serialize in class DataTypeo - A Enum object.buffer - serialize to this buffer.BufferOverflowException - if buffer overflows.deserialize(ByteBuffer)public Object deserialize(ByteBuffer buffer) throws BufferUnderflowException
Enum in
buffer.deserialize in class DataTypebuffer - Deserialize the Enum object from
this ByteBuffer.Enum.BufferUnderflowException - if buffer contains an incomplete serialized enum.serialize(Object, ByteBuffer)protected void createSerializer(MessageType.MessageField field, String fieldName, String indent, Formatter output)
ByteBuffer.createSerializer in class DataTypefield - message field.fieldName - the message field name.indent - indent the code by this amount.output - write the code to this formatter.protected void createDeserializer(MessageType.MessageField field, String fieldName, String indent, Formatter output, boolean useBuilder)
ByteBuffer based on the enum ordinal value.createDeserializer in class DataTypefield - message field.fieldName - store the de-serialized field in this
name.indent - indent the code by this amount.output - append the code to this formatter.useBuilder - if true then fieldName
is a builder method name; otherwise a local variable.Copyright © 2019. All rights reserved.