FasterXML / FasterXML/jackson-dataformats-binary

[cbor] Consider adding support for custom tag handling

Ouverte
#105 8 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
cbor
Langage dominant
Java
Étoiles
347
Forks
156
Merge moyen
3 j 3 h
PR mergées (30 j)
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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.