[JAVA-2264] Support constructor based serialization Created: 28/Jul/16  Updated: 05/Jun/17  Resolved: 27/Mar/17

Status: Closed
Project: Java Driver
Component/s: Codecs
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Justin Lee Assignee: Ross Lawley
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by JAVA-2247 Support decoding of GeoJSON objects Closed
Epic Link: POJO

 Description   

Rather than instantiating an empty instance via a no-arg constructor, allow for the construction of entities via constructor that takes values for the fields. Questions to answer:

  1. Should all the fields be required in the constructor?
    • If no, should the remaining fields be set via field injection?
  2. Should the constructor parameter names be forced to match field names so we can order them properly when invoking?
    • Should we rely on document order instead?
    • Should we allow for explicitly mapping constructor parameters to fields via annotations on those parameters?


 Comments   
Comment by Ross Lawley [ 27/Mar/17 ]

Constructor based codecs are not natively supported because of the lack of access to parameter names which pre java 8 are lost during compilation.

Generated at Thu Feb 08 08:56:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.