File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
driver-core/src/main/com/mongodb Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ public final class MongoNamespace {
3232
3333 private final String databaseName ;
3434 private final String collectionName ;
35+ private final String fullName ; // cache to avoid repeated string building
3536
3637 /**
3738 * Construct an instance.
@@ -45,6 +46,7 @@ public MongoNamespace(final String fullName) {
4546
4647 this .databaseName = getDatatabaseNameFromFullName (fullName );
4748 this .collectionName = getCollectionNameFullName (fullName );
49+ this .fullName = fullName ;
4850 }
4951
5052 /**
@@ -56,6 +58,7 @@ public MongoNamespace(final String fullName) {
5658 public MongoNamespace (final String databaseName , final String collectionName ) {
5759 this .databaseName = notNull ("databaseName" , databaseName );
5860 this .collectionName = notNull ("collectionName" , collectionName );
61+ this .fullName = databaseName + "." + collectionName ;
5962 }
6063
6164 /**
@@ -82,7 +85,7 @@ public String getCollectionName() {
8285 * @return the full name
8386 */
8487 public String getFullName () {
85- return getDatabaseName () + "." + getCollectionName () ;
88+ return fullName ;
8689 }
8790
8891 @ Override
@@ -113,7 +116,7 @@ public boolean equals(final Object o) {
113116 */
114117 @ Override
115118 public String toString () {
116- return databaseName + "." + collectionName ;
119+ return fullName ;
117120 }
118121
119122 @ Override
You can’t perform that action at this time.
0 commit comments