Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 0.9.4, 0.9.5, 1.0.0, 1.1
-
Fix Version/s: 1.2
-
Component/s: None
-
Labels:None
Description
Now that ObjectMapper's deserialization works quite well (minus annotation support, as of 0.9.6), it would be nice to improve construction of POJOs.
Specifically it would be good to allow using a non-default constructors (that is, constructor that takes one or more arguments). This feature would allow not having to add setters whose only purpose is to support data deserialization; similar to how dependency injection frameworks work.
The main open questions are:
(a) How to recognize that such a constructor should be used
(b) How to bind constuctor arguments.
Given that local names for constructor args are not guaranteed to be accessible (not sure if they are ever stored, but they need not be), for (b) it seems sensible to require annotations to be added.
As to (a) here is the initial thought:
- If there are multiple acceptable constructor, an annotation is required to be used
- If there is only one constructor, that can be used without annotation, as long as the arguments are properly annotated?
Looks like this won't make it in 1.1, but will be a top priority for 1.2 – esp. since it will be required for proper object serialization support (or at least some of pre-requisites will be).