mongo/src/org/immutables/mongo/repository/RepositorySetup.java
public static RepositorySetup forUri(String uri) {
    MongoClientURI clientUri = new MongoClientURI(uri);
    @Nullable String databaseName = clientUri.getDatabase();
    checkArgument(databaseName != null, "URI should contain database path segment");

    return builder()
        .database(newMongoClient(clientUri).getDatabase(databaseName))
        .executor(newExecutor())
        .gson(createGson())
        .build();
  }
public static RepositorySetup forUri(String uri) {
    MongoClientURI clientUri = new MongoClientURI(uri);
    @Nullable String databaseName = clientUri.getDatabase();
    checkArgument(databaseName != null, "URI should contain database path segment");

    return builder()
        .database(newMongoClient(clientUri).getDatabase(databaseName))
        .executor(newExecutor())
        .gson(createGson())
        .build();
  }
Create setup using MongoDB client uri.
<ul>
<li>URI should contain database path segment</li>
<li>New internal {@link MongoClient} will be created</li>
<li>New internal executor will be created (with shutdown on jvm exit)</li>
<li>New {@link Gson} instance will be created configured with type adapter factory
providers</li>
</ul>
<p>
Setup created by this factory methods should be reused to configure collection repositories for
the same MongoDB database.
<p>
This constructor designed for ease of use in sample scenarious. For more flexibility consider
using {@link #builder()} with custom constructed {@link ListeningExecutorService
executor} and {@link DB database} handle.
@param uri string that will be parsed as {@link MongoClientURI}.
@see MongoClientURI
@return repository setup instance.