FasterXML / FasterXML/jackson-dataformats-binary

[cbor] Consider adding support for custom tag handling

Abierto
#105 8 comentarios 0 reacciones 0 asignados Ver en GitHub
cbor
Lenguaje dominante
Java
Estrellas
347
Forks
156
Merge medio
3 d 3 h
PR fusionados (30 d)
22

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.