Skip to content

Commit c3e5e8a

Browse files
committed
JAVA-924: deprecate access to protected fields in gridfs
1 parent 07c11ff commit c3e5e8a

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

src/main/com/mongodb/gridfs/GridFS.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ public List<GridFSDBFile> find( DBObject query , DBObject sort){
243243
return files;
244244
}
245245

246+
/**
247+
* @deprecated This method is NOT a part of public API and will be dropped in 3.x versions.
248+
*/
249+
@Deprecated
246250
protected GridFSDBFile _fix( Object o ){
247251
if ( o == null )
248252
return null;
@@ -410,9 +414,47 @@ public DB getDB(){
410414
return _db;
411415
}
412416

417+
/**
418+
* Gets the {@link DBCollection} in which the file’s metadata is stored.
419+
*
420+
* @return the collection
421+
*/
422+
protected DBCollection getFilesCollection() {
423+
return _filesCollection;
424+
}
425+
426+
/**
427+
* Gets the {@link DBCollection} in which the binary chunks are stored.
428+
*
429+
* @return the collection
430+
*/
431+
protected DBCollection getChunksCollection() {
432+
return _chunkCollection;
433+
}
434+
435+
436+
/**
437+
* @deprecated Please use {@link #getDB()} for access.
438+
*/
439+
@Deprecated
413440
protected final DB _db;
441+
442+
/**
443+
* @deprecated Please use {@link #getBucketName()} for access.
444+
*/
445+
@Deprecated
414446
protected final String _bucketName;
447+
448+
/**
449+
* @deprecated Please use {@link #getFilesCollection()} for access.
450+
*/
451+
@Deprecated
415452
protected final DBCollection _filesCollection;
453+
454+
/**
455+
* @deprecated Please use {@link #getChunksCollection()} for access.
456+
*/
457+
@Deprecated
416458
protected final DBCollection _chunkCollection;
417459

418460
}

src/main/com/mongodb/gridfs/GridFSFile.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,15 @@ public String toString(){
276276
return JSON.serialize( this );
277277
}
278278

279+
/**
280+
* Gets the GridFS associated with this file
281+
*
282+
* @return gridFS instance
283+
*/
284+
protected GridFS getGridFS(){
285+
return this._fs;
286+
}
287+
279288
/**
280289
* Sets the GridFS associated with this file
281290
* @param fs
@@ -284,6 +293,10 @@ protected void setGridFS( GridFS fs ){
284293
_fs = fs;
285294
}
286295

296+
/**
297+
* @deprecated Please use {@link #getGridFS()} & {@link #setGridFS(GridFS)} instead.
298+
*/
299+
@Deprecated
287300
protected GridFS _fs = null;
288301

289302
Object _id;

0 commit comments

Comments
 (0)