Interface SerializationWriter
- All Superinterfaces:
AutoCloseable,Closeable
Defines an interface for serialization of objects to a stream.
-
Method Summary
Modifier and TypeMethodDescriptionGets the callback called after the object gets serialized.Gets the callback called before the object gets serialized.Gets the callback called right after the serialization process starts.Gets the value of the serialized content.voidSets the callback called after the objects gets serialized.voidSets the callback called before the objects gets serialized.voidSets the callback called right after the serialization process starts.voidwriteAdditionalData(Map<String, Object> value) Writes the specified additional data values to the stream with an optional given key.voidwriteBigDecimalValue(String key, BigDecimal value) Writes the specified BigDecimal value to the stream with an optional given key.voidwriteBooleanValue(String key, Boolean value) Writes the specified Boolean value to the stream with an optional given key.voidwriteByteArrayValue(String key, byte[] value) Writes the byte array value to the current stream with an optional given key.voidwriteByteValue(String key, Byte value) Writes the specified Byte value to the stream with an optional given key.<T extends Enum<T>>
voidwriteCollectionOfEnumValues(String key, Iterable<T> values) Writes the specified collection of enum values to the stream with an optional given key.<T extends Parsable>
voidwriteCollectionOfObjectValues(String key, Iterable<T> values) Writes the specified collection of object values to the stream with an optional given key.<T> voidwriteCollectionOfPrimitiveValues(String key, Iterable<T> values) Writes the specified collection of primitive values to the stream with an optional given key.voidwriteDoubleValue(String key, Double value) Writes the specified Double value to the stream with an optional given key.<T extends Enum<T>>
voidwriteEnumSetValue(String key, EnumSet<T> values) Writes the specified enum set value to the stream with an optional given key.<T extends Enum<T>>
voidwriteEnumValue(String key, T value) Writes the specified enum value to the stream with an optional given key.voidwriteFloatValue(String key, Float value) Writes the specified Float value to the stream with an optional given key.voidwriteIntegerValue(String key, Integer value) Writes the specified Integer value to the stream with an optional given key.voidwriteLocalDateValue(String key, LocalDate value) Writes the specified LocalDate value to the stream with an optional given key.voidwriteLocalTimeValue(String key, LocalTime value) Writes the specified LocalTime value to the stream with an optional given key.voidwriteLongValue(String key, Long value) Writes the specified Long value to the stream with an optional given key.voidwriteNullValue(String key) Writes a null value for the specified key.<T extends Parsable>
voidwriteObjectValue(String key, T value, Parsable... additionalValuesToMerge) Writes the specified model object value to the stream with an optional given key.voidwriteOffsetDateTimeValue(String key, OffsetDateTime value) Writes the specified OffsetDateTime value to the stream with an optional given key.voidwritePeriodAndDurationValue(String key, PeriodAndDuration value) Writes the specified Period/Duration value to the stream with an optional given key.voidwriteShortValue(String key, Short value) Writes the specified Short value to the stream with an optional given key.voidwriteStringValue(String key, String value) Writes the specified string value to the stream with an optional given key.voidwriteUUIDValue(String key, UUID value) Writes the specified UUID value to the stream with an optional given key.
-
Method Details
-
writeStringValue
Writes the specified string value to the stream with an optional given key.- Parameters:
key- the key to write the value with.value- the value to write to the stream.
-
writeBooleanValue
Writes the specified Boolean value to the stream with an optional given key.- Parameters:
key- the key to write the value with.value- the value to write to the stream.
-
writeByteValue
Writes the specified Byte value to the stream with an optional given key.- Parameters:
key- the key to write the value with.value- the value to write to the stream.
-
writeShortValue
Writes the specified Short value to the stream with an optional given key.- Parameters:
key- the key to write the value with.value- the value to write to the stream.
-
writeBigDecimalValue
Writes the specified BigDecimal value to the stream with an optional given key.- Parameters:
key- the key to write the value with.value- the value to write to the stream.
-
writeIntegerValue
Writes the specified Integer value to the stream with an optional given key.- Parameters:
key- the key to write the value with.value- the value to write to the stream.
-
writeFloatValue
Writes the specified Float value to the stream with an optional given key.- Parameters:
key- the key to write the value with.value- the value to write to the stream.
-
writeDoubleValue
Writes the specified Double value to the stream with an optional given key.- Parameters:
key- the key to write the value with.value- the value to write to the stream.
-
writeLongValue
Writes the specified Long value to the stream with an optional given key.- Parameters:
key- the key to write the value with.value- the value to write to the stream.
-
writeUUIDValue
Writes the specified UUID value to the stream with an optional given key.- Parameters:
key- the key to write the value with.value- the value to write to the stream.
-
writeOffsetDateTimeValue
Writes the specified OffsetDateTime value to the stream with an optional given key.- Parameters:
key- the key to write the value with.value- the value to write to the stream.
-
writeLocalDateValue
Writes the specified LocalDate value to the stream with an optional given key.- Parameters:
key- the key to write the value with.value- the value to write to the stream.
-
writeLocalTimeValue
Writes the specified LocalTime value to the stream with an optional given key.- Parameters:
key- the key to write the value with.value- the value to write to the stream.
-
writePeriodAndDurationValue
Writes the specified Period/Duration value to the stream with an optional given key.- Parameters:
key- the key to write the value with.value- the value to write to the stream.
-
writeCollectionOfPrimitiveValues
Writes the specified collection of primitive values to the stream with an optional given key.- Type Parameters:
T- the type of the primitive.- Parameters:
key- the key to write the value with.values- the value to write to the stream.
-
writeCollectionOfObjectValues
<T extends Parsable> void writeCollectionOfObjectValues(@Nullable String key, @Nullable Iterable<T> values) Writes the specified collection of object values to the stream with an optional given key.- Type Parameters:
T- the type of the object.- Parameters:
key- the key to write the value with.values- the value to write to the stream.
-
writeCollectionOfEnumValues
<T extends Enum<T>> void writeCollectionOfEnumValues(@Nullable String key, @Nullable Iterable<T> values) Writes the specified collection of enum values to the stream with an optional given key.- Type Parameters:
T- the type of the enum.- Parameters:
key- the key to write the value with.values- the values to write to the stream.
-
writeObjectValue
<T extends Parsable> void writeObjectValue(@Nullable String key, @Nullable T value, @Nonnull Parsable... additionalValuesToMerge) Writes the specified model object value to the stream with an optional given key.- Type Parameters:
T- the type of the model object.- Parameters:
key- the key to write the value with.value- the value to write to the stream.additionalValuesToMerge- the additional values to merge to the main value when serializing an intersection wrapper.
-
getSerializedContent
Gets the value of the serialized content.- Returns:
- the value of the serialized content.
-
writeEnumSetValue
Writes the specified enum set value to the stream with an optional given key.- Type Parameters:
T- the type of the enum.- Parameters:
key- the key to write the value with.values- the value to write to the stream.
-
writeEnumValue
Writes the specified enum value to the stream with an optional given key.- Type Parameters:
T- the type of the enum.- Parameters:
key- the key to write the value with.value- the value to write to the stream.
-
writeNullValue
Writes a null value for the specified key.- Parameters:
key- the key to write the value with.
-
writeAdditionalData
Writes the specified additional data values to the stream with an optional given key.- Parameters:
value- the values to write to the stream.
-
getOnBeforeObjectSerialization
Gets the callback called before the object gets serialized.- Returns:
- the callback called before the object gets serialized.
-
getOnAfterObjectSerialization
Gets the callback called after the object gets serialized.- Returns:
- the callback called after the object gets serialized.
-
getOnStartObjectSerialization
Gets the callback called right after the serialization process starts.- Returns:
- the callback called right after the serialization process starts.
-
setOnBeforeObjectSerialization
Sets the callback called before the objects gets serialized.- Parameters:
value- the callback called before the objects gets serialized.
-
setOnAfterObjectSerialization
Sets the callback called after the objects gets serialized.- Parameters:
value- the callback called after the objects gets serialized.
-
setOnStartObjectSerialization
Sets the callback called right after the serialization process starts.- Parameters:
value- the callback called right after the serialization process starts.
-
writeByteArrayValue
Writes the byte array value to the current stream with an optional given key.- Parameters:
key- the key to write the value with.value- the value to write to the stream.
-