[JAVA-3914] Event SET_PRIVATE_FIELDS_CONVENTION enabled, the field need an public getter to be set Created: 18/Dec/20 Updated: 27/Oct/23 Resolved: 04/Jan/21 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | POJO |
| Affects Version/s: | 4.1.1 |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | dorian rodriguez | Assignee: | Jeffrey Yemin |
| Resolution: | Gone away | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Description |
|
Hello, I try to play with pojo and "SET_PRIVATE_FIELDS_CONVENTION" but that convention doesn't work if an public getter is not set.
My constructor of client :
My pojo class :
The result :
Currently for fix that issue i have need to make an public getter "getUsername". I have also try to put "@BsonProperty("username")" to "getName" method.
Thanks.
|
| Comments |
| Comment by Backlog - Core Eng Program Management Team [ 04/Jan/21 ] | ||||
|
There hasn't been any recent activity on this ticket, so we're resolving it. Thanks for reaching out! Please feel free to comment on this if you're able to provide more information. | ||||
| Comment by Jeffrey Yemin [ 18/Dec/20 ] | ||||
|
Hi orblazer.minecraft@gmail.com Thanks for reaching out. I think this is the intended behavior, based on the documentation for the convention, which says:
The driver still requires the getter method during the encoding process. Are you asking for an additional convention where the driver also uses the private field during encoding? |