-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Trivial - P5
-
None
-
Affects Version/s: None
-
Component/s: POJO
Summary
I have a (superclass) that overloads a set method for one of it's properties. It's simply for convenience. The Java driver gets confused and can't differentiate the set method for the actual property type verse the signature for the alternate.
An example would be:
public class Dataset { @BsonProperty("property") protected List<String> property; public Dataset() { } @BsonCreator public Dataset(@BsonProperty("property") List<String> property) { this.property = property; } public List<String> getProperty() { return property; } public void setProperty(List<String> property) { this.property = property; } /** * This method is a problem. * @param property */ public void setProperty(String property) { if (this.property == null) { this.property = new ArrayList<>(); } this.property.add(property); } } }
Motivation
Who is the affected end user?
Anyone implementing PoJo classes with overloaded property methods.
How does this affect the end user?
BSON serialization fails.
How likely is it that this problem or use case will occur?
Edge case.
If the problem does occur, what are the consequences and how severe are they?
BSON serialization fails.
Is this issue urgent?
Not urgent.
Is this ticket required by a downstream team?
No.
Is this ticket only for tests?
No.