本文整理汇总了Java中org.onosproject.ovsdb.rfc.schema.type.AtomicColumnType类的典型用法代码示例。如果您正苦于以下问题:Java AtomicColumnType类的具体用法?Java AtomicColumnType怎么用?Java AtomicColumnType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AtomicColumnType类属于org.onosproject.ovsdb.rfc.schema.type包,在下文中一共展示了AtomicColumnType类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getValueFromAtoType
import org.onosproject.ovsdb.rfc.schema.type.AtomicColumnType; //导入依赖的package包/类
/**
* Convert AtomicColumnType JsonNode into OvsdbSet value.
* @param json AtomicColumnType JsonNode
* @param atoType AtomicColumnType entity
* @return Object OvsdbSet or the value of JsonNode
*/
private static Object getValueFromAtoType(JsonNode json, AtomicColumnType atoType) {
BaseType baseType = atoType.baseType();
// If "min" or "max" is not specified, If "min" is not 1 or "max" is not
// 1, or both, and "value" is not specified, the type is a set of scalar
// type "key". Refer to RFC 7047, Section 3.2 <type>.
if (atoType.min() != atoType.max()) {
Set set = Sets.newHashSet();
if (json.isArray()) {
if (json.size() == 2) {
if (json.get(0).isTextual() && "set".equals(json.get(0).asText())) {
for (JsonNode node : json.get(1)) {
set.add(transToValue(node, baseType));
}
} else {
set.add(transToValue(json, baseType));
}
}
} else {
set.add(transToValue(json, baseType));
}
return OvsdbSet.ovsdbSet(set);
} else {
return transToValue(json, baseType);
}
}
示例2: getValueFromJson
import org.onosproject.ovsdb.rfc.schema.type.AtomicColumnType; //导入依赖的package包/类
/**
* Transform JsonNode to corresponding value.
* @param json the ColumnType JsonNode
* @param columnType AtomicColumnType or KeyValuedColumnType
* @return Object OvsdbMap or OvsdbSet
*/
public static Object getValueFromJson(JsonNode json, ColumnType columnType) {
if (columnType instanceof AtomicColumnType) {
AtomicColumnType atoType = (AtomicColumnType) columnType;
return getValueFromAtoType(json, atoType);
} else if (columnType instanceof KeyValuedColumnType) {
KeyValuedColumnType kvType = (KeyValuedColumnType) columnType;
return getValueFromKvType(json, kvType);
}
return null;
}
示例3: generateInitializationColumns
import org.onosproject.ovsdb.rfc.schema.type.AtomicColumnType; //导入依赖的package包/类
/**
* Refer to RFC 7047 Section 3.2. generate initialization columns in each
* table namely _uuid and _version.
*/
public void generateInitializationColumns() {
columnSchemas
.put("_uuid",
new ColumnSchema("_uuid",
new AtomicColumnType(new UuidBaseType())));
columnSchemas
.put("_version",
new ColumnSchema("_version",
new AtomicColumnType(new UuidBaseType())));
}