abstract class SerializationFactory
An abstraction for serializing and deserializing objects, with support for versioning of the wire format via a header / prefix in the bytes.
SerializationFactory()
An abstraction for serializing and deserializing objects, with support for versioning of the wire format via a header / prefix in the bytes. |
val currentContext: SerializationContext?
If there is a need to nest serialization/deserialization with a modified context during serialization or deserialization, this will return the current context used to start serialization/deserialization. |
|
val defaultContext: SerializationContext
A context to use as a default if you do not require a specially configured context. It will be the current context if the use is somehow nested (see currentContext). |
fun <T> asCurrent(block: SerializationFactory.() -> T): T
Allow subclasses to temporarily mark themselves as the current factory for the current thread during serialization/deserialization. Will restore the prior context on exiting the block. |
|
abstract fun <T : Any> deserialize(byteSequence: ByteSequence, clazz: Class<T>, context: SerializationContext): T
Deserialize the bytes in to an object, using the prefixed bytes to determine the format. |
|
abstract fun <T : Any> deserializeWithCompatibleContext(byteSequence: ByteSequence, clazz: Class<T>, context: SerializationContext): ObjectWithCompatibleContext<T>
Deserialize the bytes in to an object, using the prefixed bytes to determine the format. |
|
abstract fun <T : Any> serialize(obj: T, context: SerializationContext): SerializedBytes<T>
Serialize an object to bytes using the preferred serialization format version from the context. |
|
fun <T> withCurrentContext(context: SerializationContext?, block: () -> T): T
Change the current context inside the block to that supplied. |
val currentFactory: SerializationFactory?
If there is a need to nest serialization/deserialization with a modified context during serialization or deserialization, this will return the current factory used to start serialization/deserialization. |
|
val defaultFactory: SerializationFactory
A default factory for serialization/deserialization, taking into account the currentFactory if set. |
fun Any.contextLogger(): <ERROR CLASS>
When called from a companion object, returns the logger for the enclosing class. |