当前位置: 首页>>代码示例>>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;未经允许,请勿转载。