public abstract static class AbstractMongoTemplate.Builder extends Object
AbstractMongoTemplate.
The MongoDatabase is a hard requirement and as such should be provided. Can either be provided
directly, or by setting a MongoClient. When choosing the latter approach, the MongoDatabase name can be
specified by using the mongoDatabase(MongoClient, String) function. Otherwise, the database name
defaults to DEFAULT_AXONFRAMEWORK_DATABASE
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
AbstractMongoTemplate.Builder |
mongoDatabase(com.mongodb.client.MongoClient mongoClient)
Sets the
MongoDatabase by means of providing a MongoClient. |
AbstractMongoTemplate.Builder |
mongoDatabase(com.mongodb.client.MongoClient mongoClient,
String databaseName)
Sets the
MongoDatabase by means of providing a MongoClient. |
AbstractMongoTemplate.Builder |
mongoDatabase(com.mongodb.client.MongoDatabase mongoDatabase)
Sets the
MongoDatabase used by this template to connect to a Mongo instance. |
protected void |
validate()
Validates whether the fields contained in this Builder are set accordingly.
|
public AbstractMongoTemplate.Builder mongoDatabase(com.mongodb.client.MongoClient mongoClient)
MongoDatabase by means of providing a MongoClient. The MongoClient.getDatabase(String) function is in turn used to retrieve the MongoDatabase, using DEFAULT_AXONFRAMEWORK_DATABASE as the database name.mongoClient - the MongoClient used to retrieve a MongoDatabase frompublic AbstractMongoTemplate.Builder mongoDatabase(com.mongodb.client.MongoClient mongoClient, String databaseName)
MongoDatabase by means of providing a MongoClient. The MongoClient.getDatabase(String) function is in turn used to retrieve the MongoDatabase using databaseName as the database name.mongoClient - the MongoClient used to retrieve a MongoDatabase fromdatabaseName - a String denoting the name of the MongoDatabasepublic AbstractMongoTemplate.Builder mongoDatabase(com.mongodb.client.MongoDatabase mongoDatabase)
MongoDatabase used by this template to connect to a Mongo instance.mongoDatabase - the MongoDatabase used by this template to connect to a Mongo instanceprotected void validate()
throws org.axonframework.common.AxonConfigurationException
org.axonframework.common.AxonConfigurationException - if one field is asserted to be incorrect according to the Builder's
specificationsCopyright © 2010–2022. All rights reserved.