Package net.sf.eBus.messages.type
Class UUIDType
- java.lang.Object
-
- net.sf.eBus.messages.type.DataType
-
- net.sf.eBus.messages.type.UUIDType
-
- All Implemented Interfaces:
java.lang.Comparable<DataType>
public final class UUIDType extends DataType
Provides binary serialization of aUUID
instance. Transmits the UUID as two longs: most-significant bits and least-significant bits.- Author:
- Charles W. Rapp
-
-
Field Summary
Fields Modifier and Type Field Description static int
BYTES
AUUID
requires two long (8 byte) integers.-
Fields inherited from class net.sf.eBus.messages.type.DataType
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
createDeserializer(MessageType.MessageField field, java.lang.String fieldName, java.lang.String indent, java.util.Formatter output, boolean useBuilder)
Generates code to de-serialize UUID instance from aByteBuffer
.protected void
createSerializer(MessageType.MessageField field, java.lang.String fieldName, java.lang.String indent, java.util.Formatter output)
Generates Java code used to serialize a UUID field to aByteBuffer
.java.lang.Object
deserialize(MessageType.MessageField field, java.nio.ByteBuffer buffer)
Returns a UUID instance de-serialized from the given buffer.void
serialize(java.lang.Object o, MessageType.MessageField field, java.nio.ByteBuffer buffer)
Serializes this UUID instance to the given buffer.-
Methods inherited from class net.sf.eBus.messages.type.DataType
compareTo, dataClass, dataClassName, defaultValue, equals, fields, findCharset, findType, hashCode, isArray, isBoolean, isBoolean, isBuiltin, isEnum, isField, isFixedSize, isInstance, isLocalOnly, isMessage, isPrimitive, maxAllowedTextSize, replyClasses, size, toString
-
-
-
-
Field Detail
-
BYTES
public static final int BYTES
AUUID
requires two long (8 byte) integers.- See Also:
- Constant Field Values
-
-
Method Detail
-
serialize
public void serialize(java.lang.Object o, MessageType.MessageField field, java.nio.ByteBuffer buffer)
Serializes this UUID instance to the given buffer.- Specified by:
serialize
in classDataType
- Parameters:
o
- a UUID instance.field
- contains external information needed to serialize this message field.buffer
- serialize to this buffer.- Throws:
java.nio.BufferOverflowException
- ifbuffer
does not have available space to store the serialized URI.- See Also:
deserialize(net.sf.eBus.messages.type.MessageType.MessageField, java.nio.ByteBuffer)
-
deserialize
public java.lang.Object deserialize(MessageType.MessageField field, java.nio.ByteBuffer buffer)
Returns a UUID instance de-serialized from the given buffer.- Specified by:
deserialize
in classDataType
- Parameters:
field
- contains information needed to de-serialize this message field.buffer
- extract serialized UUID from this buffer.- Returns:
- UUID instance.
- Throws:
java.nio.BufferUnderflowException
- ifbuffer
contains an incomplete UUID serialization.- See Also:
serialize(java.lang.Object, net.sf.eBus.messages.type.MessageType.MessageField, java.nio.ByteBuffer)
-
createSerializer
protected void createSerializer(MessageType.MessageField field, java.lang.String fieldName, java.lang.String indent, java.util.Formatter output)
Generates Java code used to serialize a UUID field to aByteBuffer
.- Specified by:
createSerializer
in classDataType
- Parameters:
field
- message field.fieldName
- message field name.indent
- indent code by this amount.output
- write code to this formatter.
-
createDeserializer
protected void createDeserializer(MessageType.MessageField field, java.lang.String fieldName, java.lang.String indent, java.util.Formatter output, boolean useBuilder)
Generates code to de-serialize UUID instance from aByteBuffer
.- Specified by:
createDeserializer
in classDataType
- Parameters:
field
- message field.fieldName
- store de-serialized field in this name.indent
- indent code by this amount.output
- append code to this formatter.useBuilder
- iftrue
thenfieldName
is a builder method name; otherwise a local variable.
-
-