Interface SerializeOutput
- All Superinterfaces:
ConfigurationDefinition.WriteOptions,SerializeContext
SerializeDeserialize.serialize(V, space.arim.dazzleconf.engine.SerializeOutput).
Serializers MUST call one of the output methods in this class. The output methods start with "out" and are
distinguished by the argument type, which helps callers ensure that they are passing a valid output type.
If no object is output when serialize returns, that is considered a library usage error, and an exception
may be thrown at a later time.
Advanced usage
This SerializeOutput stores the last object output to it. Calling more than one "out" method will overwrite
the value stored in this instance, which will in turn change the return value of this method. This output can be
extracted (and simultaneously cleared) by calling getAndClearLastOutput().
-
Method Summary
Modifier and TypeMethodDescription@Nullable ObjectGets the last output, clears it in thisSerializeOutput, and returns it to the caller.voidoutBoolean(boolean value) Outputs a booleanvoidoutByte(byte value) Outputs a bytevoidoutChar(char value) Outputs a charactervoidoutDataList(@NonNull DataList value) Outputs a data listvoidoutDataTree(@NonNull DataTree value) Outputs a data treevoidoutDouble(double value) Outputs a doublevoidoutFloat(float value) Outputs a floatvoidoutInt(int value) Outputs an integervoidoutLong(long value) Outputs a longvoidoutObjectUnchecked(@NonNull Object value) Outputs the given object.voidoutShort(short value) Outputs a shortvoidOutputs a stringMethods inherited from interface space.arim.dazzleconf.engine.SerializeContext
keyMapper, writeEntryComments
-
Method Details
-
outString
Outputs a string- Parameters:
value- the string, nonnull
-
outBoolean
void outBoolean(boolean value) Outputs a boolean- Parameters:
value- the boolean
-
outByte
void outByte(byte value) Outputs a byte- Parameters:
value- the byte
-
outChar
void outChar(char value) Outputs a character- Parameters:
value- the character
-
outShort
void outShort(short value) Outputs a short- Parameters:
value- the short
-
outInt
void outInt(int value) Outputs an integer- Parameters:
value- the integer
-
outLong
void outLong(long value) Outputs a long- Parameters:
value- the long
-
outFloat
void outFloat(float value) Outputs a float- Parameters:
value- the float
-
outDouble
void outDouble(double value) Outputs a double- Parameters:
value- the double
-
outDataTree
Outputs a data tree- Parameters:
value- the data tree
-
outDataList
Outputs a data list- Parameters:
value- the data list
-
outObjectUnchecked
Outputs the given object.This function should not be used in normal circumstances. It is a low-level means of setting the output object, intended for when the caller has a ready object but does not know its exact type.
The caller guarantees that the passed object is valid according to
DataEntry.validateValue(Object). If this condition is not met, behavior is not defined and an exception may be thrown at a later point.- Parameters:
value- the object
-
getAndClearLastOutput
@Nullable Object getAndClearLastOutput()Gets the last output, clears it in thisSerializeOutput, and returns it to the caller.Any one of the "out" methods on this type will affect the return value of this method. Whichever was called last will be yielded here, or
nullif none were called. Because this method also clears the stored value, calling it twice will always yieldnull.- Returns:
- the last object output, or null if there is none
-