@DoNotImplement public SerializationContext
Parameters to serialization and deserialization.
@NotNull ByteSequence getPreferredSerializationVersion()
When serializing, use the format this header sequence represents.
@Nullable SerializationEncoding getEncoding()
If non-null, apply this encoding (typically compression) when serializing.
@NotNull java.lang.ClassLoader getDeserializationClassLoader()
The class loader to use for deserialization.
@NotNull ClassWhitelist getWhitelist()
A whitelist that contains (mostly for security purposes) which classes can be serialized and deserialized.
@NotNull EncodingWhitelist getEncodingWhitelist()
A whitelist that determines (mostly for security purposes) whether a particular encoding may be used when deserializing.
@NotNull java.util.Map<java.lang.Object,java.lang.Object> getProperties()
A map of any additional properties specific to the particular use case.
boolean getObjectReferencesEnabled()
Duplicate references to the same object preserved in the wire format and when deserialized when this is true, otherwise they appear as new copies of the object.
boolean getLenientCarpenterEnabled()
If true the carpenter will happily synthesis classes that implement interfaces containing methods that are not getters for any AMQP fields. Invoking these methods will throw an AbstractMethodError. If false then an exception will be thrown during deserialization instead.
The default is false.
boolean getCarpenterDisabled()
If true, deserialization calls using this context will not fallback to using the Class Carpenter to attempt to construct classes present in the schema but not on the current classpath.
The default is false.
boolean getPreventDataLoss()
If true the serialization evolver will fail if the binary to be deserialized contains more fields then the current object from the classpath.
The default is false.
@NotNull net.corda.core.serialization.SerializationContext.UseCase getUseCase()
The use case we are serializing or deserializing for. See enum SerializationContext.UseCase
.
enum SerializationContext.UseCase
@NotNull java.util.Set<net.corda.core.serialization.SerializationCustomSerializer> getCustomSerializers()
Additional custom serializers that will be made available during (de)serialization.
@NotNull SerializationContext withProperty(@NotNull java.lang.Object property, @NotNull java.lang.Object value)
Helper method to return a new context based on this context with the property added.
@NotNull SerializationContext withProperties(@NotNull java.util.Map<java.lang.Object,? extends java.lang.Object> extraProperties)
Helper method to return a new context based on this context with the extra properties added.
@NotNull SerializationContext withoutReferences()
Helper method to return a new context based on this context with object references disabled.
@NotNull SerializationContext withLenientCarpenter()
Return a new context based on this one but with a lenient carpenter.
lenientCarpenterEnabled
@NotNull SerializationContext withoutCarpenter()
Returns a copy of the current context with carpentry of unknown classes disabled. On encountering such a class during deserialization the Serialization framework will throw a NotSerializableException.
@NotNull SerializationContext withPreventDataLoss()
Return a new context based on this one but with a strict evolution.
preventDataLoss
@NotNull SerializationContext withClassLoader(@NotNull java.lang.ClassLoader classLoader)
Helper method to return a new context based on this context with the deserialization class loader changed.
@Deprecated @NotNull SerializationContext withAttachmentsClassLoader(@NotNull java.util.List<? extends net.corda.core.crypto.SecureHash> attachmentHashes)
Does not do anything.
@NotNull SerializationContext withWhitelisted(@NotNull java.lang.Class<?> clazz)
Helper method to return a new context based on this context with the given class specifically whitelisted.
@NotNull SerializationContext withCustomSerializers(@NotNull java.util.Set<? extends net.corda.core.serialization.SerializationCustomSerializer<?,?>> serializers)
Helper method to return a new context based on this context with the given serializers added.
@NotNull SerializationContext withPreferredSerializationVersion(@NotNull ByteSequence magic)
Helper method to return a new context based on this context but with serialization using the format this header sequence represents.
@NotNull SerializationContext withEncoding(@Nullable SerializationEncoding encoding)
A shallow copy of this context but with the given (possibly null) encoding.
@NotNull SerializationContext withEncodingWhitelist(@NotNull EncodingWhitelist encodingWhitelist)
A shallow copy of this context but with the given encoding whitelist.