[JAVA-3707] Support package scanning for Discriminators Created: 21/Apr/20  Updated: 30/Mar/22

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

Type: Improvement Priority: Major - P3
Reporter: Ross Lawley Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Zip Archive scratch.zip    
Issue Links:
Related
related to JAVA-3935 PojoCodecProvider recognition of clas... Closed
is related to JAVA-3665 Polymorphic POJO mapping does not wor... Closed

 Description   

Currently classes using discriminators must either:

  • Be explicitly registered
  • Contain the whole class path including the package
  • Be named after the class and have the package path registered in the PojoCodecProvider.

It would be simpler for users to use any Discriminator they like and support scanning for discriminators.



 Comments   
Comment by John Lilley [ 21/Apr/20 ]

Thanks Ross, I attached an example which illustrates the issue.

Comment by Ross Lawley [ 21/Apr/20 ]

A side effect of such work would be to allow Automatic & Package registered Pojos to support:

MongoCollection<WidgetsInterface> collection = database.getCollection("widgets", WidgetsInterface.class);
List<WidgetsInterface> myWidgets = collection.find().into(new Array<WidgetsInterface>());

Generated at Thu Feb 08 09:00:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.