Skip to content
This repository was archived by the owner on Jan 9, 2025. It is now read-only.

Add public serializer API#286

Merged
fh-ms merged 8 commits intomasterfrom
feature/serializer
Dec 8, 2021
Merged

Add public serializer API#286
fh-ms merged 8 commits intomasterfrom
feature/serializer

Conversation

@fh-ms
Copy link
Copy Markdown
Contributor

@fh-ms fh-ms commented Dec 6, 2021

In order to make it easier to use our serialization engine, we offer a more user-friendly API.

A single type with a medium type parameter as well as a foundation.
As medium types, Binary and byte[] are supported by default.
The ObjectCopier and the Cache's serialization should use the new type then as well.

New types

  • one.microstream.persistence.binary.util.Serializer
  • one.microstream.persistence.binary.util.SerializerFoundation

Code sample:

import java.time.LocalDateTime;

import one.microstream.persistence.binary.util.Serializer;
import one.microstream.persistence.binary.util.SerializerFoundation;

public class Test
{
	public static void main(final String[] args)
	{
		final SerializerFoundation<?> foundation = SerializerFoundation.New()
			.registerEntityTypes(LocalDateTime.class);
		final Serializer<byte[]> serializer = Serializer.Bytes(foundation);
		
		final LocalDateTime ldt1 = LocalDateTime.now();
		final byte[] bytes = serializer.serialize(ldt1);
		final LocalDateTime ldt2 = serializer.deserialize(bytes);
		
		System.out.println(ldt1.equals(ldt2));
	}
}

@fh-ms fh-ms added the enhancement New feature or request label Dec 6, 2021
@fh-ms fh-ms added this to the 07.00.00 milestone Dec 6, 2021
@fh-ms fh-ms requested a review from zdenek-jonas December 6, 2021 13:38
@zdenek-jonas
Copy link
Copy Markdown
Contributor

Please add documentation on unsupported types:

  • Lazy
  • IdentityHashMap
  • one.microstream.collections.HashTable

Copy link
Copy Markdown
Contributor

@zdenek-jonas zdenek-jonas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@fh-ms fh-ms merged commit a5bc2ee into master Dec 8, 2021
@zdenek-jonas zdenek-jonas deleted the feature/serializer branch July 18, 2022 09:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants