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.YearMonthvalues.- Author:
- Charles W. Rapp
-
-
Field Summary
Fields Modifier and Type Field Description static intBYTESAYearMonthrequires 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 voidcreateDeserializer(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 aPeriodinstance from aByteBuffer.protected voidcreateSerializer(MessageType.MessageField field, java.lang.String fieldName, java.lang.String indent, java.util.Formatter output)Adds the Java code used to serialize aPeriodinstance to aByteBuffer.java.lang.Objectdeserialize(MessageType.MessageField field, java.nio.ByteBuffer buffer)Returns the de-serializedPeriodvalue by converting the encoded year, month, and day values back to aPeriodusingYearMonth.of(int, int).voidserialize(java.lang.Object o, MessageType.MessageField field, java.nio.ByteBuffer buffer)Serializes thePeriodyear, 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
AYearMonthrequires 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 thePeriodyear, month, and day values tobuffer.- Specified by:
serializein classDataType- Parameters:
o- aPeriodinstance.field- contains external information needed to serialize this message field.buffer- write to this buffer.- Throws:
java.nio.BufferOverflowException- ifbufferdoes not contain enough space to store thePeriodvalue.- 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-serializedPeriodvalue by converting the encoded year, month, and day values back to aPeriodusingYearMonth.of(int, int).- Specified by:
deserializein 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- ifbufferdoes not contain the completePeriodvalue.- 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 aPeriodinstance to aByteBuffer.- Specified by:
createSerializerin classDataType- Parameters:
field- message field.fieldName- thePeriodmessage 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 aPeriodinstance from aByteBuffer.- Specified by:
createDeserializerin classDataType- Parameters:
field- message field.fieldName- thePeriodmessage field name.indent- indent code by this many spaces.output- output code to here.useBuilder- iftruethenfieldNameis a builder method name; otherwise a local variable.
-
-