1414 * @author antoine
1515 */
1616public class DBCallback extends BasicBSONCallback {
17-
17+
1818 public static interface Factory {
1919 public DBCallback create ( DBCollection collection );
2020 }
2121
2222 static class DefaultFactory implements Factory {
23+ @ Override
2324 public DBCallback create ( DBCollection collection ){
2425 return new DBCallback ( collection );
2526 }
@@ -40,30 +41,30 @@ public void gotDBRef( String name , String ns , ObjectId id ){
4041 else
4142 cur ().put ( name , new DBPointer ( (DBObject )cur () , name , _db , ns , id ) );
4243 }
43-
44+
4445 @ Override
4546 public void objectStart (boolean array , String name ){
4647 _lastName = name ;
4748 super .objectStart ( array , name );
4849 }
49-
50+
5051 @ Override
5152 public Object objectDone (){
5253 BSONObject o = (BSONObject )super .objectDone ();
53- if ( ! ( o instanceof List ) &&
54- o .containsField ( "$ref" ) &&
54+ if ( ! ( o instanceof List ) &&
55+ o .containsField ( "$ref" ) &&
5556 o .containsField ( "$id" ) ){
5657 return cur ().put ( _lastName , new DBRef ( _db , o ) );
5758 }
58-
59+
5960 return o ;
6061 }
61-
62+
6263 @ Override
6364 public BSONObject create (){
6465 return _create ( null );
6566 }
66-
67+
6768 @ Override
6869 public BSONObject create ( boolean array , List <String > path ){
6970 if ( array )
@@ -72,7 +73,7 @@ public BSONObject create( boolean array , List<String> path ){
7273 }
7374
7475 private DBObject _create ( List <String > path ){
75-
76+
7677 Class c = null ;
7778
7879 if ( _collection != null && _collection ._objectClass != null ){
@@ -88,9 +89,9 @@ private DBObject _create( List<String> path ){
8889 }
8990 c = _collection .getInternalClass ( buf .toString () );
9091 }
91-
92+
9293 }
93-
94+
9495 if ( c != null ){
9596 try {
9697 return (DBObject )c .newInstance ();
@@ -104,7 +105,7 @@ private DBObject _create( List<String> path ){
104105 throw new MongoInternalException ( "can't instantiate a : " + c , iae );
105106 }
106107 }
107-
108+
108109 if ( _collection != null && _collection ._name .equals ( "$cmd" ) )
109110 return new CommandResult ();
110111 return new BasicDBObject ();
@@ -114,7 +115,7 @@ DBObject dbget(){
114115 DBObject o = (DBObject )get ();
115116 return o ;
116117 }
117-
118+
118119 @ Override
119120 public void reset (){
120121 _lastName = null ;
0 commit comments