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, CLASS_TYPE, DEFAULT_CHARSET, EMPTY_STRING, FIELD_MASK_SIZE, INDENT, INDENT1, KEY_TYPE, MAX_ARRAY_SIZE, MAX_BIG_INTEGER_SIZE, MAX_CLASS_NAME_LENGTH, MAX_FIELDS, MAX_FILE_NAME_LENGTH, MAX_STRING_LENGTH, MAX_ZONE_ID_LENGTH, mBuiltinFlag, mClass, mDefaultValue, mIsFixedSize, mSize, sClasses, sCompiledClasses, sTextTypes, STRING_TYPE, sVariableTypes, VARIABLE_SIZE
Modifier and Type | Method and Description |
---|---|
protected void |
createDeserializer(MessageType.MessageField field,
java.lang.String fieldName,
java.lang.String indent,
java.util.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,
java.lang.String fieldName,
java.lang.String indent,
java.util.Formatter output)
Adds the Java code used to serialize the enum ordinal
value to a
ByteBuffer . |
java.lang.Object |
deserialize(MessageType.MessageField field,
java.nio.ByteBuffer buffer)
Returns the de-serialized
Enum in
buffer . |
boolean |
isInstance(java.lang.Object o)
Returns
true if o is a non-null
enum instance and false otherwise. |
void |
serialize(java.lang.Object o,
MessageType.MessageField field,
java.nio.ByteBuffer buffer)
Serializes this
Enum ordinal to the given
buffer . |
compareTo, dataClass, dataClassName, defaultValue, equals, fields, findCharset, findType, hashCode, isArray, isBoolean, isBoolean, isBuiltin, isEnum, isField, isFixedSize, isLocalOnly, isMessage, isPrimitive, maxAllowedTextSize, replyClasses, size, toString
public static final int BYTES
enum
requires 2 bytes for encoding.public boolean isInstance(java.lang.Object o)
true
if o
is a non-null
enum instance and false
otherwise.isInstance
in class DataType
o
- Check this object's type.true
if o
is a non-null
enum instance and false
otherwise.public void serialize(java.lang.Object o, MessageType.MessageField field, java.nio.ByteBuffer buffer)
Enum
ordinal to the given
buffer
.serialize
in class DataType
o
- A Enum
object. May be null
.field
- contains external information needed to
serialize this message field.buffer
- serialize to this buffer.java.nio.BufferOverflowException
- if buffer
overflows.deserialize(net.sf.eBus.messages.type.MessageType.MessageField, java.nio.ByteBuffer)
public java.lang.Object deserialize(MessageType.MessageField field, java.nio.ByteBuffer buffer)
Enum
in
buffer
.deserialize
in class DataType
field
- contains information needed to de-serialize
this message field.buffer
- de-serialize the Enum
object from
this ByteBuffer
.Enum
.java.nio.BufferUnderflowException
- if buffer
contains an incomplete serialized enum.serialize(java.lang.Object, net.sf.eBus.messages.type.MessageType.MessageField, java.nio.ByteBuffer)
protected void createSerializer(MessageType.MessageField field, java.lang.String fieldName, java.lang.String indent, java.util.Formatter output)
ByteBuffer
.createSerializer
in class DataType
field
- 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, java.lang.String fieldName, java.lang.String indent, java.util.Formatter output, boolean useBuilder)
ByteBuffer
based on the enum ordinal value.createDeserializer
in class DataType
field
- 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 © 2001 - 2024. Charles W. Rapp. All rights reserved.