-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Is there a way to serialize class objects and transform the output of a serialized class?
I found an implementation for class object serialization in CatLib called XjsObjectMapper or something similar. Is there a way to take a class and convert it to xjs with modified serialization?
I’m looking for something similar to Gson or Jankson’s ability to register serializers and deserializers.
Here’s an example of what I’m asking:
Can I transform the output from the following class to use the codec (from Mojang’s DataFixerUpper) from the TypedEntry instance?
(Method of finding the correct codec to use for deserialization not shown because it’s a bit complicated)
public class SerializableObject {
private static final TypedEntryType<CustomObject> CUSTOM_TYPE = new TypedEntryType<>(CustomObject.CODEC);
public String serializedString; // serialized normally
public TypedEntry<CustomObject> customObject; // uses the codec from CUSTOM_TYPE
}public record TypedEntryType<T>(Codec<T> codec) {}
public record TypedEntry<T>(TypedEntryType<T> type, T value) {}Metadata
Metadata
Assignees
Labels
No labels