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