[JAVA-3303] @BsonProperty on a getter is ignored if the field is not serialized anyway Created: 29/May/19  Updated: 30/Mar/22

Status: Backlog
Project: Java Driver
Component/s: POJO
Affects Version/s: 3.10.2
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Björn Kautler Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to JAVA-3304 @BsonProperty is necessary on getter ... Backlog

 Description   

If I have a getter/setter pair like
public long get07()
and
public void set07(long _07)
I don't see any way to make these serialize and deserialize using the POJO support.
Adding @BsonProperty("07") has no effect at all and the field is simply ignored completely.
The only way I found was to add another pair of getter/setter that has some name that is recognized as property and then use the annotation to configure the name.

Imho adding the annotation to a paramterless getter should be enough to make it serialize.


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