/** * Construct an instance for the given full name. The database name is the string preceding the first {@code "."} character. * * @param fullName the non-null full namespace * @see #checkDatabaseNameValidity(String) * @see #checkCollectionNameValidity(String) */ public MongoNamespace(final String fullName) { notNull("fullName", fullName); this.fullName = fullName; this.databaseName = getDatatabaseNameFromFullName(fullName); this.collectionName = getCollectionNameFullName(fullName); checkDatabaseNameValidity(databaseName); checkCollectionNameValidity(collectionName); }
/** * Construct an instance from the given database name and collection name. * * @param databaseName the valid database name * @param collectionName the valid collection name * @see #checkDatabaseNameValidity(String) * @see #checkCollectionNameValidity(String) */ @BsonCreator public MongoNamespace(@BsonProperty("db") final String databaseName, @BsonProperty("coll") final String collectionName) { checkDatabaseNameValidity(databaseName); checkCollectionNameValidity(collectionName); this.databaseName = databaseName; this.collectionName = collectionName; this.fullName = databaseName + '.' + collectionName; }
/** * Constructs new {@code DBCollection} instance. This operation not reflected on the server. * @param name the name of the collection * @param database the database to which this collections belongs to */ DBCollection(final String name, final DB database, final OperationExecutor executor) { checkCollectionNameValidity(name); this.name = name; this.database = database; this.executor = executor; this.optionHolder = new Bytes.OptionHolder(database.getOptionHolder()); this.objectFactory = new DBCollectionObjectFactory(); this.objectCodec = new CompoundDBObjectCodec(getDefaultDBObjectCodec()); this.retryWrites = database.getMongo().getMongoClientOptions().getRetryWrites(); }
/** * Construct an instance for the given full name. The database name is the string preceding the first {@code "."} character. * * @param fullName the non-null full namespace * @see #checkDatabaseNameValidity(String) * @see #checkCollectionNameValidity(String) */ public MongoNamespace(final String fullName) { notNull("fullName", fullName); this.fullName = fullName; this.databaseName = getDatatabaseNameFromFullName(fullName); this.collectionName = getCollectionNameFullName(fullName); checkDatabaseNameValidity(databaseName); checkCollectionNameValidity(collectionName); }
/** * Construct an instance from the given database name and collection name. * * @param databaseName the valid database name * @param collectionName the valid collection name * @see #checkDatabaseNameValidity(String) * @see #checkCollectionNameValidity(String) */ @BsonCreator public MongoNamespace(@BsonProperty("db") final String databaseName, @BsonProperty("coll") final String collectionName) { checkDatabaseNameValidity(databaseName); checkCollectionNameValidity(collectionName); this.databaseName = databaseName; this.collectionName = collectionName; this.fullName = databaseName + '.' + collectionName; }
/** * Constructs new {@code DBCollection} instance. This operation not reflected on the server. * @param name the name of the collection * @param database the database to which this collections belongs to */ DBCollection(final String name, final DB database, final OperationExecutor executor) { checkCollectionNameValidity(name); this.name = name; this.database = database; this.executor = executor; this.optionHolder = new Bytes.OptionHolder(database.getOptionHolder()); this.objectFactory = new DBCollectionObjectFactory(); this.objectCodec = new CompoundDBObjectCodec(getDefaultDBObjectCodec()); this.retryWrites = database.getMongo().getMongoClientOptions().getRetryWrites(); }