public abstract class AbstractSerializer extends Object implements Serializer
| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractSerializer.NullValue |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSerializer(Upcaster<SerializedObject<byte[],?>> upcasterChain) |
| Modifier and Type | Method and Description |
|---|---|
protected Class<?> |
classForType(String type) |
<S extends SerializedObject<byte[],S>> |
deserialize(Stream<S> dataStream,
boolean failOnUnknownType)
Upcasts and deserializes a stream of serialized objects.
|
protected abstract Object |
doDeserialize(byte[] bytes,
Class<?> type) |
protected abstract byte[] |
doSerialize(Object object) |
protected String |
getObjectType(Object object) |
protected Revision |
getRevision(Object object) |
protected Stream<DeserializingObject<byte[],?>> |
handleUnknownType(SerializedObject<byte[],?> serializedObject) |
Data<byte[]> |
serialize(Object object)
Serializes an object to a
Data object containing a byte array. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdeserializeprotected AbstractSerializer(Upcaster<SerializedObject<byte[],?>> upcasterChain)
public Data<byte[]> serialize(Object object)
SerializerData object containing a byte array.serialize in interface Serializerobject - The instance to serializepublic <S extends SerializedObject<byte[],S>> Stream<DeserializingObject<byte[],S>> deserialize(Stream<S> dataStream, boolean failOnUnknownType)
Serializer
Deserialization is performed lazily. This means that actual conversion for a given result in the output stream
only happens if DeserializingObject.getPayload() is invoked on the result. This has the advantage that a
caller can inspect what type will be returned via DeserializingObject.getSerializedObject() before
deciding to go through with the deserialization.
You can specify whether deserialization of a result in the output stream should fail with a SerializationException if a type is unknown (not a class). It is up to the implementation to determine what
should happen if a type is unknown but the failOnUnknownType flag is false.
deserialize in interface SerializerS - the type of the serialized objectdataStream - data input stream to deserializefailOnUnknownType - flag that determines whether deserialization of an unknown type should give an
exceptionprotected Stream<DeserializingObject<byte[],?>> handleUnknownType(SerializedObject<byte[],?> serializedObject)
Copyright © 2019 Flux Capacitor. All rights reserved.