You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since tag system in CBOR is extensible, users may well want to use custom tags.
Although there is a very bare-bones accessibility mechanism with CBORParser, basically 2 methods:
public int getCurrentTag() {
return _tagValues.getFirstTag();
}
public TagList getCurrentTags() {
return _tagValues;
}
it would be good to have some sort of mechanism (callback(s)?) to allow some automation of handling -- to give low-level access to CBORParser state upon encountering tags (either ones not supported by Jackson CBOR module, or maybe all).
I don't know exactly how that should look like so help would be appreciated.
The text was updated successfully, but these errors were encountered:
I have currently succeeded in using jackson-cbor to handle serialization/deserialization with custom tags. I'm not sure if my implementation is sufficient, but it works exactly as I expected🎉.
From my experience, during serialization, I can continue using the JsonSerializer interface, so the main issues are concentrated in the Parser part.
For composite structures, they are converted to TreeNode first and then further transformed into the target type, and a context is needed to store the result. In such, I can reuse most of the functionality without having to process each token individually;
If possible, use JsonDeserializer for deserialization, but it seems unlikely?
Perhaps a Visitor-like approach could be added for callbacks, such as how to handle when a certain tag is encountered?
Note: My approach may not be optimal, but I hope it can be helpful to you.
Refs: Code Curtom Tags
(note: inspired by FasterXML/jackson-core#1428)
Since tag system in CBOR is extensible, users may well want to use custom tags.
Although there is a very bare-bones accessibility mechanism with
CBORParser
, basically 2 methods:it would be good to have some sort of mechanism (callback(s)?) to allow some automation of handling -- to give low-level access to
CBORParser
state upon encountering tags (either ones not supported by Jackson CBOR module, or maybe all).I don't know exactly how that should look like so help would be appreciated.
The text was updated successfully, but these errors were encountered: