Package net.sf.eBus.messages.type
Class YearMonthType
- java.lang.Object
-
- net.sf.eBus.messages.type.DataType
-
- net.sf.eBus.messages.type.YearMonthType
-
- All Implemented Interfaces:
java.lang.Comparable<DataType>
public final class YearMonthType extends DataType
Provides binary serialization/de-serialization ofjava.time.YearMonth
values.- Author:
- Charles W. Rapp
-
-
Field Summary
Fields Modifier and Type Field Description static int
BYTES
AYearMonth
requires 8 bytes for encoding.-
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)
Adds the Java code used to de-serialize aPeriod
instance from aByteBuffer
.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 aPeriod
instance to aByteBuffer
.java.lang.Object
deserialize(MessageType.MessageField field, java.nio.ByteBuffer buffer)
Returns the de-serializedPeriod
value by converting the encoded year, month, and day values back to aPeriod
usingYearMonth.of(int, int)
.void
serialize(java.lang.Object o, MessageType.MessageField field, java.nio.ByteBuffer buffer)
Serializes thePeriod
year, month, and day values tobuffer
.-
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
AYearMonth
requires 8 bytes for encoding.- See Also:
- Constant Field Values
-
-
Method Detail
-
serialize
public void serialize(java.lang.Object o, MessageType.MessageField field, java.nio.ByteBuffer buffer)
Serializes thePeriod
year, month, and day values tobuffer
.- Specified by:
serialize
in classDataType
- Parameters:
o
- aPeriod
instance.field
- contains external information needed to serialize this message field.buffer
- write to this buffer.- Throws:
java.nio.BufferOverflowException
- ifbuffer
does not contain enough space to store thePeriod
value.- 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 the de-serializedPeriod
value by converting the encoded year, month, and day values back to aPeriod
usingYearMonth.of(int, int)
.- Specified by:
deserialize
in classDataType
- Parameters:
field
- contains information needed to de-serialize this message field.buffer
- contains the serializedPeriod
.- Returns:
- the de-serialized
Period
. - Throws:
java.nio.BufferUnderflowException
- ifbuffer
does not contain the completePeriod
value.- 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)
Adds the Java code used to serialize aPeriod
instance to aByteBuffer
.- Specified by:
createSerializer
in classDataType
- Parameters:
field
- message field.fieldName
- thePeriod
message field name.indent
- indent code by this many spaces.output
- output code to here.
-
createDeserializer
protected void createDeserializer(MessageType.MessageField field, java.lang.String fieldName, java.lang.String indent, java.util.Formatter output, boolean useBuilder)
Adds the Java code used to de-serialize aPeriod
instance from aByteBuffer
.- Specified by:
createDeserializer
in classDataType
- Parameters:
field
- message field.fieldName
- thePeriod
message field name.indent
- indent code by this many spaces.output
- output code to here.useBuilder
- iftrue
thenfieldName
is a builder method name; otherwise a local variable.
-
-