Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add public serializer API #286

Merged
merged 8 commits into from
Dec 8, 2021
Merged

Add public serializer API #286

merged 8 commits into from
Dec 8, 2021

Conversation

fh-ms
Copy link
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
@zdenek-jonas
Copy link
Contributor

Please add documentation on unsupported types:

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

Copy link
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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants