Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.3.1.2
-
None
-
Patch
Description
Currently it is difficult to modify/extend the current behaviour of the json plugin.
I had the following problem. We use joda-time because it is much better than standard Date. The json plugin cannot handle classes like LocalDate, which is not a problem in itself. But it needs a lot of boilerplate code to output beans containing a LocalDate field using json. Currently I have to create duplicates of the service layer DTO-s, annotate the fields in the UI copy with @JSONFieldBridge, and copy one DTO into the other using dozer or something.
This creates a lot of useless code and manual work. It would be much easier if I could extend JSONWriter and add support for my joda-time classes. No duplication of DTO-s, no need to manually annotate all fields. This would require only to modify the visibility of some private methods to protected, and some package-protected classes to public. This way I could create my struts2 result type, which extends JSONResult, and use my writer, which extends JSONWriter.