public SerializationContext
Parameters to serialization and deserialization.
Modifier and Type | Method and Description |
---|---|
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.
|
java.util.Set<net.corda.core.serialization.SerializationCustomSerializer> |
getCustomSerializers()
Additional custom serializers that will be made available during (de)serialization.
|
java.lang.ClassLoader |
getDeserializationClassLoader()
The class loader to use for deserialization.
|
SerializationEncoding |
getEncoding()
If non-null, apply this encoding (typically compression) when serializing.
|
EncodingWhitelist |
getEncodingWhitelist()
A whitelist that determines (mostly for security purposes) whether a particular encoding may be used when deserializing.
|
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.
|
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.
|
ByteSequence |
getPreferredSerializationVersion()
When serializing, use the format this header sequence represents.
|
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.
|
java.util.Map<java.lang.Object,java.lang.Object> |
getProperties()
A map of any additional properties specific to the particular use case.
|
SerializationContext.UseCase |
getUseCase()
The use case we are serializing or deserializing for. See
enum SerializationContext.UseCase . |
ClassWhitelist |
getWhitelist()
A whitelist that contains (mostly for security purposes) which classes can be serialized and deserialized.
|
SerializationContext |
withAttachmentsClassLoader(java.util.List<? extends net.corda.core.crypto.SecureHash> attachmentHashes)
Deprecated.
|
SerializationContext |
withClassLoader(java.lang.ClassLoader classLoader)
Helper method to return a new context based on this context with the deserialization class loader changed.
|
SerializationContext |
withCustomSerializers(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.
|
SerializationContext |
withEncoding(SerializationEncoding encoding)
A shallow copy of this context but with the given (possibly null) encoding.
|
SerializationContext |
withEncodingWhitelist(EncodingWhitelist encodingWhitelist)
A shallow copy of this context but with the given encoding whitelist.
|
SerializationContext |
withLenientCarpenter()
Return a new context based on this one but with a lenient carpenter.
|
SerializationContext |
withPreferredSerializationVersion(ByteSequence magic)
Helper method to return a new context based on this context but with serialization using the format this header sequence represents.
|
SerializationContext |
withPreventDataLoss()
Return a new context based on this one but with a strict evolution.
|
SerializationContext |
withProperties(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.
|
SerializationContext |
withProperty(java.lang.Object property,
java.lang.Object value)
Helper method to return a new context based on this context with the property added.
|
SerializationContext |
withWhitelisted(java.lang.Class<?> clazz)
Helper method to return a new context based on this context with the given class specifically whitelisted.
|
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.
|
SerializationContext |
withoutReferences()
Helper method to return a new context based on this context with object references disabled.
|
ByteSequence getPreferredSerializationVersion()
When serializing, use the format this header sequence represents.
SerializationEncoding getEncoding()
If non-null, apply this encoding (typically compression) when serializing.
java.lang.ClassLoader getDeserializationClassLoader()
The class loader to use for deserialization.
ClassWhitelist getWhitelist()
A whitelist that contains (mostly for security purposes) which classes can be serialized and deserialized.
EncodingWhitelist getEncodingWhitelist()
A whitelist that determines (mostly for security purposes) whether a particular encoding may be used when deserializing.
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.
SerializationContext.UseCase getUseCase()
The use case we are serializing or deserializing for. See enum SerializationContext.UseCase
.
enum SerializationContext.UseCase
java.util.Set<net.corda.core.serialization.SerializationCustomSerializer> getCustomSerializers()
Additional custom serializers that will be made available during (de)serialization.
SerializationContext withProperty(java.lang.Object property, java.lang.Object value)
Helper method to return a new context based on this context with the property added.
SerializationContext withProperties(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.
SerializationContext withoutReferences()
Helper method to return a new context based on this context with object references disabled.
SerializationContext withLenientCarpenter()
Return a new context based on this one but with a lenient carpenter.
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.
SerializationContext withPreventDataLoss()
Return a new context based on this one but with a strict evolution.
SerializationContext.getPreventDataLoss
SerializationContext withClassLoader(java.lang.ClassLoader classLoader)
Helper method to return a new context based on this context with the deserialization class loader changed.
SerializationContext withAttachmentsClassLoader(java.util.List<? extends net.corda.core.crypto.SecureHash> attachmentHashes)
Does not do anything.
SerializationContext withWhitelisted(java.lang.Class<?> clazz)
Helper method to return a new context based on this context with the given class specifically whitelisted.
SerializationContext withCustomSerializers(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.
SerializationContext withPreferredSerializationVersion(ByteSequence magic)
Helper method to return a new context based on this context but with serialization using the format this header sequence represents.
SerializationContext withEncoding(SerializationEncoding encoding)
A shallow copy of this context but with the given (possibly null) encoding.
SerializationContext withEncodingWhitelist(EncodingWhitelist encodingWhitelist)
A shallow copy of this context but with the given encoding whitelist.