-
Type: Improvement
-
Resolution: Won't Fix
-
Priority: Minor - P4
-
None
-
Affects Version/s: 3.10.0
-
Component/s: POJO
-
Labels:None
public class WidgetDocument { private String ssn; @BsonProperty("ssn") public String getSSN() { return ssn; } }
The PropertyModel for the field in the class above looks like:
PropertyModel{propertyName='sSN', readName='ssn', writeName='sSN', typeData=TypeData{type=String}}
Preferably I would expect propertyName="ssn". If that isn't an option than I would like to set the writeName="ssn" without the use of a setter.
If I add a setter with the @BsonProperty it works as expected,
@BsonProperty("ssn") public void setSSN(String ssn) { this.ssn = ssn; }
This can be done by manually configuring the PropertyModel writeName via the ClassBuilder etc., but ideally this should be able to be configured via annotations. Could this be achieved by allowing a @BsonProperty annotation on a field to set the writeName?