[JAVA-858] Deprecate callbacks Created: 21/Jun/13  Updated: 26/Jul/13  Resolved: 26/Jul/13

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Uladzimir Mihura Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

If we look at the usage of the following classes, we will see that they are actually used only by corresponding decoders.

  • org.bson.BSONCallback
  • org.bson.EmptyBSONCallback
  • org.bson.LazyBSONCallback
  • org.bson.BasicBSONCallback
  • com.mongodb.DBCallback
  • com.mongodb.DefaultDBCallback
  • com.mongodb.LazyDBCallback
  • com.mongodb.LazyWritableDBCallback
  • com.mongodb.util.JSONCallback
  • com.mongodb.DBCallbackFactory

At the same time com.mongodb.DBCallbackFactory is used only by DefaultDBCallback, where it is a public static field. So I think that it's better to hide all this from public api in future releases, and for now we can deprecate them.

Also we will be able to deprecate the following methods:

  • org.bson.BSONDecoder
    • int decode( byte[] b , BSONCallback callback );
    • int decode( InputStream in , BSONCallback callback ) throws IOException;
  • com.mongodb.DBDecoder
    • DBCallback getDBCallback(DBCollection collection);

As for com.mongodb.util.JSONCallback, we can just make it package-private and use directly in com.mongodb.util.JSON.JSONParser.



 Comments   
Comment by Uladzimir Mihura [ 24/Jun/13 ]

I revised the usage of callbacks. I've digged through github to find some patterns.

-vova

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