corda / net.corda.core.serialization / CustomSerializationScheme


interface CustomSerializationScheme

Implement this interface to add your own Serialization Scheme. This is an experimental feature. All methods in this class MUST be thread safe i.e. methods from the same instance of this class can be called in different threads simultaneously.



abstract fun <T : Any> deserialize(bytes: ByteSequence, clazz: Class<T>, context: SerializationSchemeContext): T

This method must deserialize the data stored bytes into an instance of T.


abstract fun getSchemeId(): Int

This method must return an id used to uniquely identify the Scheme. This should be unique within a network as serialized data might be sent over the wire.


abstract fun <T : Any> serialize(obj: T, context: SerializationSchemeContext): ByteSequence

This method must be able to serialize any object T into a ByteSequence.

Extension Functions


fun Any.contextLogger(): <ERROR CLASS>

When called from a companion object, returns the logger for the enclosing class.