當前位置: 首頁>>代碼示例>>Java>>正文


Java WriteConcern.valueOf方法代碼示例

本文整理匯總了Java中com.mongodb.WriteConcern.valueOf方法的典型用法代碼示例。如果您正苦於以下問題:Java WriteConcern.valueOf方法的具體用法?Java WriteConcern.valueOf怎麽用?Java WriteConcern.valueOf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.mongodb.WriteConcern的用法示例。


在下文中一共展示了WriteConcern.valueOf方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setReadWriteMode

import com.mongodb.WriteConcern; //導入方法依賴的package包/類
@Override
public void setReadWriteMode(String readWriteMode) {
    if (readWriteMode == null || readWriteMode.equals(lastReadWriteMode)) {
        return;
    }
    lastReadWriteMode = readWriteMode;
    try {
        Map<String, String> map = Splitter.on(", ").withKeyValueSeparator(":").split(readWriteMode);
        String read = map.get("read");
        if (read != null) {
            ReadPreference readPref = ReadPreference.valueOf(read);
            if (!readPref.equals(this.readPreference)) {
                this.readPreference = readPref;
            }
        }
        String write = map.get("write");
        if (write != null) {
            WriteConcern writeConcern = WriteConcern.valueOf(write);
            if (!writeConcern.equals(this.writeConcern)) {
                this.writeConcern = writeConcern;
            }
        }
    } catch (Exception e) {
        // unsupported or parse error - ignore
    }
}
 
開發者ID:denismo,項目名稱:jackrabbit-dynamodb-store,代碼行數:27,代碼來源:MemoryDocumentStore.java

示例2: getWriteConcern

import com.mongodb.WriteConcern; //導入方法依賴的package包/類
public static WriteConcern getWriteConcern(ExecutionOptions options) {
    if (options != null) {
        String value = options.getOptions().get(OPT_WRITE_CONCERN);
        if (value != null) {
            value = value.trim();
            if (value.length() > 0) {
                return WriteConcern.valueOf(value);
            }
        }
    }
    return null;
}
 
開發者ID:lightblue-platform,項目名稱:lightblue-mongo,代碼行數:13,代碼來源:MongoExecutionOptions.java

示例3: setWriteConcern

import com.mongodb.WriteConcern; //導入方法依賴的package包/類
/**
    * @param writeConcern
    * 				The WriteConcern setting for Mongo.<i>(may be null). If null, set to default of dbCollection's writeConcern.</i>
    */
   public void setWriteConcern(final String writeConcern) {
   	this.writeConcern = writeConcern;
	concern = WriteConcern.valueOf(writeConcern);
}
 
開發者ID:d0k1,項目名稱:log4jmongo,代碼行數:9,代碼來源:SimpleMongoDbAppender.java

示例4: setWriteConcern

import com.mongodb.WriteConcern; //導入方法依賴的package包/類
/**
 * Set the {@link WriteConcern} for write operations on MongoDB using the standard ones.
 * Resolved from the fields of the WriteConcern class by calling the {@link WriteConcern#valueOf(String)} method.
 * 
 * @param writeConcern the standard name of the WriteConcern
 * @see <a href="http://api.mongodb.org/java/current/com/mongodb/WriteConcern.html#valueOf(java.lang.String)">possible options</a>
 */
public void setWriteConcern(String writeConcern) {
    this.writeConcern = WriteConcern.valueOf(writeConcern);
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:11,代碼來源:MongoDbEndpoint.java


注:本文中的com.mongodb.WriteConcern.valueOf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。