TargetType - Type of the object to serialize from.ReaderType - Type of the Builder object, which must implement ObjectBuilder(of TargetType). This will be used
for deserialization.public abstract static class VersionedSerializer.WithBuilder<TargetType,ReaderType extends ObjectBuilder<TargetType>> extends VersionedSerializer<TargetType>
class Attribute {
private final Long value;
private final Long lastUsed;
// Attribute class is immutable; it has a builder that helps create new instances (this can be generated with Lombok).
static class AttributeBuilder implements ObjectBuilder { ... }
}
class AttributeSerializer extends VersionedSerializer.WithBuilder { VersionedSerializer.Direct<TargetType>, VersionedSerializer.FormatVersion<TargetType,ReaderType>, VersionedSerializer.MultiType<BaseType>, VersionedSerializer.StreamReader<ReaderType>, VersionedSerializer.StreamWriter<TargetType>, VersionedSerializer.WithBuilder<TargetType,ReaderType extends ObjectBuilder<TargetType>>| Constructor and Description |
|---|
WithBuilder() |
| Modifier and Type | Method and Description |
|---|---|
TargetType |
deserialize(ArrayView data)
Deserializes data from the given ArrayView and creates a new object with the result.
|
TargetType |
deserialize(byte[] data)
Deserializes data from the given byte array and creates a new object with the result.
|
TargetType |
deserialize(java.io.InputStream stream)
Deserializes data from the given InputStream and creates a new object with the result.
|
TargetType |
deserialize(RevisionDataInput dataInput)
Deserializes data from the given RevisionDataInput and creates a new object with the result.
|
protected abstract ReaderType |
newBuilder()
When implemented in a derived class, this method will return a new instance of the Builder each time it is invoked.
|
serialize, serializeprotected abstract ReaderType newBuilder()
public TargetType deserialize(RevisionDataInput dataInput) throws java.io.IOException
dataInput - The RevisionDataInput to deserialize from.java.io.IOException - If an IO Exception occurred.public TargetType deserialize(java.io.InputStream stream) throws java.io.IOException
stream - The InputStream to deserialize from.java.io.IOException - If an IO Exception occurred.public TargetType deserialize(byte[] data) throws java.io.IOException
data - The byte array to deserialize from.java.io.IOException - If an IO Exception occurred.public TargetType deserialize(ArrayView data) throws java.io.IOException
data - The ArrayView to deserialize from.java.io.IOException - If an IO Exception occurred.