Codota Logo
CollectionCallback.doInCollection
Code IndexAdd Codota to your IDE (free)

How to use
doInCollection
method
in
sockslib.utils.mongo.CollectionCallback

Best Java code snippets using sockslib.utils.mongo.CollectionCallback.doInCollection (Showing top 4 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
origin: theotherp/nzbhydra2

public <T> T execute(String collectionName, CollectionCallback<T> callback) {
  MongoDatabase database = null;
  if (mongoClient == null) {
    mongoClient = getConnectedClient();
  }
  return callback.doInCollection(
      mongoClient.getDatabase(databaseName).getCollection(collectionName));
}
origin: fengyouchao/sockslib

public <T> T execute(String collectionName, CollectionCallback<T> callback) {
 MongoDatabase database = null;
 if (mongoClient == null) {
  mongoClient = getConnectedClient();
 }
 return callback.doInCollection(
   mongoClient.getDatabase(databaseName).getCollection(collectionName));
}
origin: theotherp/nzbhydra2

/**
 * Connect MongoDB and call callback, close connection at last.
 *
 * @param collectionName Collection name.
 * @param callback       Callback
 * @param <T>            The type of value which you want to return.
 * @return The value which callback returned.
 */
public <T> T connect(String collectionName, CollectionCallback<T> callback) {
  MongoClient client = null;
  T t = null;
  try {
    client = getConnectedClient();
    MongoDatabase database = client.getDatabase(databaseName);
    MongoCollection<Document> collection = database.getCollection(collectionName);
    t = callback.doInCollection(collection);
  } finally {
    if (client != null) {
      client.close();
    }
  }
  return t;
}
origin: fengyouchao/sockslib

/**
 * Connect MongoDB and call callback, close connection at last.
 *
 * @param collectionName Collection name.
 * @param callback       Callback
 * @param <T>            The type of value which you want to return.
 * @return The value which callback returned.
 */
public <T> T connect(String collectionName, CollectionCallback<T> callback) {
 MongoClient client = null;
 T t = null;
 try {
  client = getConnectedClient();
  MongoDatabase database = client.getDatabase(databaseName);
  MongoCollection<Document> collection = database.getCollection(collectionName);
  t = callback.doInCollection(collection);
 } finally {
  if (client != null) {
   client.close();
  }
 }
 return t;
}
sockslib.utils.mongoCollectionCallbackdoInCollection

Javadoc

This method is a callback method.

Popular methods of CollectionCallback

    Popular in Java

    • Updating database using SQL prepared statement
    • getOriginalFilename (MultipartFile)
      Return the original filename in the client's filesystem.This may contain path information depending
    • getResourceAsStream (ClassLoader)
    • runOnUiThread (Activity)
    • BigDecimal (java.math)
      An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
    • Charset (java.nio.charset)
      A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
    • Collections (java.util)
      This class consists exclusively of static methods that operate on or return collections. It contains
    • Cipher (javax.crypto)
      This class provides access to implementations of cryptographic ciphers for encryption and decryption
    • Runner (org.openjdk.jmh.runner)
    • LoggerFactory (org.slf4j)
      The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
    Codota Logo
    • Products

      Search for Java codeSearch for JavaScript codeEnterprise
    • IDE Plugins

      IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Codota for your IDE now