Details
-
Type:
New Feature
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
I'm using JSON filter in my project. But I found one discomfort while working with it.
In my project I have universal mechanism of serialization objects to JSON. In this mechanism I try dinamically detect, if object has filters. If it has, then I use filter mechanism.
For example, I have Mail bean in my project. And this Mail bean refers to Player bean:
In my Player bean I have some fields, which I don't need to serialize, when serialize Mail(but in other cases I need it all). That's why I use JSON Filter: I add JsonFilter("playerFilter") annotaion to Player class. And after, when I serialize Mail object, I add fields to "playerFilter". That's ok.
But, for example, I have reference to player from other bean. But this time, I don't need in filtering fields of Player object(but need filtering fields of other objects). And when I try to serialize object, I must to add anything to playerFilter, or (else) I get exception:"org.codehaus.jackson.map.JsonMappingException - No filter configured with id 'playerFilter'". So, I need always configure filter, even I don't need it. I think, it would be more handy: if i don't configure filter - serialize all default fields.
Hmmh. Ok, yes, this actually makes sense.