Interface TypedSerializer<M>

Type Parameters:
M - the medium type
All Superinterfaces:
AutoCloseable, Serializer<M>
All Known Implementing Classes:
TypedSerializer.Default

public interface TypedSerializer<M>
extends Serializer<M>
Convenient API layer to use the binary persistence functionality for a serializer that includes type informations in the serialized data.

It is based on a SerializerFoundation, which can be configured to various needs.

Per default Binary and byte[] are supported as medium types.

The included type information can be configured by supplying a SerializerTypeInfoStrategy using a SerializerTypeInfoStrategyCreator to the SerializerFoundation.

  • Method Details

    • Binary

      static Serializer<Binary> Binary()
      Create a new TypedSerializer instance using the default configuration. The serialized data is supplied as MicroStream Binary. The serializer will include the whole set of current type information in every serialized Binary.
      Returns:
      A new TypedSerializer instance.
    • Binary

      static Serializer<Binary> Binary​(SerializerFoundation<?> foundation)
      Create a new TypedSerializer instance based upon the supplied SerializerFoundation. The serialized data is supplied as byte array. The serializer will include the whole set of current type information in every serialized Binary.
      Parameters:
      foundation - the foundation to base the serializer on
      Returns:
      A new TypedSerializer instance.
    • Bytes

      static Serializer<byte[]> Bytes()
      Create a new TypedSerializer instance using the default configuration. The serialized data is supplied as byte array. The serializer will include the whole set of current type information in every serialized byte array.
      Returns:
      A new TypedSerializer instance.
    • Bytes

      static Serializer<byte[]> Bytes​(SerializerFoundation<?> foundation)
      Create a new TypedSerializer instance based upon the supplied SerializerFoundation. The serialized data is supplied as byte array. The serializer will include the whole set of current type information in every serialized byte array.
      Parameters:
      foundation - SerializerFoundation used to configure the serializer instance.
      Returns:
      A new TypedSerializer instance.
    • 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)