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


Java WriteConcern.SAFE屬性代碼示例

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


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

示例1: toWriteConcern

public WriteConcern toWriteConcern(Object obj, WriteConcern defaultValue) {
	if(obj instanceof WriteConcern) return (WriteConcern) obj;
	if(decision.isSimpleValue(obj)) {
		String str = caster.toString(obj,"");
		str=str.trim().toUpperCase();
		if("ACKNOWLEDGED".equals(str))
			return WriteConcern.ACKNOWLEDGED;
		else if("ACKNOWLEDGED".equals(str))
			return WriteConcern.FSYNC_SAFE;
		else if("FSYNC_SAFE".equals(str) || "FSYNCSAFE".equals(str))
			return WriteConcern.FSYNCED;
		else if("JOURNAL_SAFE".equals(str) || "JOURNALSAFE".equals(str))
			return WriteConcern.JOURNAL_SAFE;
		else if("JOURNALED".equals(str))
			return WriteConcern.JOURNALED;
		else if("MAJORITY".equals(str))
			return WriteConcern.MAJORITY;
		else if("NORMAL".equals(str))
			return WriteConcern.NORMAL;
		else if("REPLICA_ACKNOWLEDGED".equals(str) || "REPLICAACKNOWLEDGED".equals(str))
			return WriteConcern.REPLICA_ACKNOWLEDGED;
		else if("REPLICAS_SAFE".equals(str) || "REPLICASSAFE".equals(str))
			return WriteConcern.REPLICAS_SAFE;
		else if("SAFE".equals(str))
			return WriteConcern.SAFE;
		else if("UNACKNOWLEDGED".equals(str))
			return WriteConcern.UNACKNOWLEDGED;
	}
	return defaultValue;
}
 
開發者ID:lucee,項目名稱:extension-mongodb,代碼行數:30,代碼來源:ObjectSupport.java

示例2: getWriteConcern

@SuppressWarnings("deprecation")
private WriteConcern getWriteConcern(String writeConcern) {
	if ("ACKNOWLEDGED".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.ACKNOWLEDGED;
	}
	if ("W1".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.W1;
	}
	if ("W2".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.W2;
	}
	if ("W3".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.W3;
	}
	if ("UNACKNOWLEDGED".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.UNACKNOWLEDGED;
	}
	if ("FSYNCED".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.FSYNCED;
	}
	if ("REPLICA_ACKNOWLEDGED".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.REPLICA_ACKNOWLEDGED;
	}
	if ("NORMAL".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.NORMAL;
	}
	if ("SAFE".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.SAFE;
	}
	if ("MAJORITY".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.MAJORITY;
	}
	if ("FSYNC_SAFE".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.FSYNC_SAFE;
	}
	if ("JOURNAL_SAFE".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.JOURNAL_SAFE;
	}
	if ("REPLICAS_SAFE".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.REPLICAS_SAFE;
	}
	return WriteConcern.ACKNOWLEDGED;
}
 
開發者ID:xsonorg,項目名稱:tangyuan2,代碼行數:43,代碼來源:DefaultDataSourceCreater.java


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