FasterXML / FasterXML/jackson-dataformats-binary

[cbor] Consider adding support for custom tag handling

Open
#105 8 comments 0 reactions 0 assignees View on GitHub
cbor
Dominant language
Java
Stars
347
Forks
156
Avg merge
3d 3h
Merged PRs (30d)
22

Description

It would be nice if there were some programming interface allowing for custom tag-to-type mapping. For instance:

CborTag customTag = CborTag.fromInt(customTagValue);
CborTagDeserializer customTagDeserializer = new CborTagDeserializer<>() { ... };
CBORFactory cborFactory = new CBORFactory();
cborFactory.addTagDeserializer(customTag, customTagDeserializer);
ObjectMapper mapper = new ObjectMapper(cborFactory);
SomeType object = mapper.readValue(cborData, SomeType.class);

CborTagDeserializer might be defined as such:

public interface CborTagDeserializer
{
T deserializeTaggedData(byte[] taggedData);
}

Likewise, there should be a way to handle serialization:

public interface CborTagSerializer
{
byte[] serializeTaggedType(T value);
}

CborTagSerializer customTagSerializer = new CborTagSerializer<>() { ... };
cborFactory.addTagSerializer(customTag, customTagSerializer);
cborFactory.addTaggedTypeMapping(SomeType.class, customTag);

Are there any plans to add support for such a feature?

Thanks.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.