FasterXML / FasterXML/jackson-dataformats-binary
[cbor] Consider adding support for custom tag handling
- 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.