@Immutable public final class MongoNamespace extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COMMAND_COLLECTION_NAME |
Constructor and Description |
---|
MongoNamespace(java.lang.String fullName)
Construct an instance for the given full name.
|
MongoNamespace(java.lang.String databaseName,
java.lang.String collectionName)
Construct an instance from the given database name and collection name.
|
Modifier and Type | Method and Description |
---|---|
static void |
checkCollectionNameValidity(java.lang.String collectionName)
Check the validity of the given collection name.
|
static void |
checkDatabaseNameValidity(java.lang.String databaseName)
Check the validity of the given database name.
|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getCollectionName()
Gets the collection name.
|
java.lang.String |
getDatabaseName()
Gets the database name.
|
java.lang.String |
getFullName()
Gets the full name, which is the database name and the collection name, separated by a period.
|
int |
hashCode() |
java.lang.String |
toString()
Returns the standard MongoDB representation of a namespace, which is
<database>.<collection> . |
public static final java.lang.String COMMAND_COLLECTION_NAME
public MongoNamespace(java.lang.String fullName)
"."
character.fullName
- the non-null full namespacecheckDatabaseNameValidity(String)
,
checkCollectionNameValidity(String)
public MongoNamespace(@BsonProperty(value="db") java.lang.String databaseName, @BsonProperty(value="coll") java.lang.String collectionName)
databaseName
- the valid database namecollectionName
- the valid collection namecheckDatabaseNameValidity(String)
,
checkCollectionNameValidity(String)
public static void checkDatabaseNameValidity(java.lang.String databaseName)
" ", "."
. The server may impose additional restrictions on database names.databaseName
- the database namejava.lang.IllegalArgumentException
- if the database name is invalidpublic static void checkCollectionNameValidity(java.lang.String collectionName)
collectionName
- the collection namejava.lang.IllegalArgumentException
- if the collection name is invalid@BsonProperty(value="db") public java.lang.String getDatabaseName()
@BsonProperty(value="coll") public java.lang.String getCollectionName()
public java.lang.String getFullName()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
<database>.<collection>
.toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object