Interface Serializer<M>
-
- Type Parameters:
M- the medium type
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
TypedSerializer<M>
- All Known Implementing Classes:
Serializer.Default,TypedSerializer.Default
public interface Serializer<M> extends AutoCloseable
Convenient API layer to use the binary persistence functionality for a simple serializer.It is based on a
SerializerFoundation, which can be configured to various needs.Per default
Binaryandbyte[]are supported as medium types.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classSerializer.Default<M>static interfaceSerializer.Sourcestatic classSerializer.Staticstatic interfaceSerializer.Target
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static Serializer<Binary>Binary()static Serializer<Binary>Binary(SerializerFoundation<?> foundation)static Serializer<byte[]>Bytes()static Serializer<byte[]>Bytes(SerializerFoundation<?> foundation)<T> Tdeserialize(M medium)Recreates an object graph based on the given data.static <M> Serializer<M>New(Function<Binary,M> toMedium, Function<M,Binary> toBinary)static <M> Serializer<M>New(SerializerFoundation<?> foundation, Function<Binary,M> toMedium, Function<M,Binary> toBinary)Mserialize(Object object)Serializes the given object graph into the medium type.-
Methods inherited from interface java.lang.AutoCloseable
close
-
-
-
-
Method Detail
-
serialize
M serialize(Object object)
Serializes the given object graph into the medium type.- Parameters:
object- the graph's root- Returns:
- the binary format
-
deserialize
<T> T deserialize(M medium)
Recreates an object graph based on the given data.- Type Parameters:
T- the object's type- Parameters:
medium- the medium to read from- Returns:
- the deserialized object graph
-
Binary
static Serializer<Binary> Binary()
-
Binary
static Serializer<Binary> Binary(SerializerFoundation<?> foundation)
-
Bytes
static Serializer<byte[]> Bytes()
-
Bytes
static Serializer<byte[]> Bytes(SerializerFoundation<?> foundation)
-
New
static <M> Serializer<M> New(Function<Binary,M> toMedium, Function<M,Binary> toBinary)
-
New
static <M> Serializer<M> New(SerializerFoundation<?> foundation, Function<Binary,M> toMedium, Function<M,Binary> toBinary)
-
-