本文整理了Java中org.onosproject.yang.compiler.datamodel.YangLeaf
类的一些代码示例,展示了YangLeaf
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangLeaf
类的具体详情如下:
包路径:org.onosproject.yang.compiler.datamodel.YangLeaf
类名称:YangLeaf
[英]Represents leaf data represented in YANG.
[中]表示以YANG表示的叶数据。
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
@Override
public int getMandatoryChildCount()
throws DataModelException {
throw new DataModelException("Leaf can't have child. " +
getName() + " in " +
getLineNumber() + " at " +
getCharPosition() +
" in " + getFileName() + "\"");
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
YangLeaf clonedLeaf;
if (!isDeviation) {
clonedLeaf = leaf.clone();
addUnresolvedType(yangUses, clonedLeaf,
(YangNode) clonedNode);
} else {
clonedLeaf = leaf.cloneForDeviation();
clonedLeaf.setReferredLeaf(leaf);
clonedLeaf.setContainedIn(clonedNode);
clonedLeaves.add(clonedLeaf);
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
@Override
public void isValueValid(String value)
throws DataModelException {
getDataType().isValidValue(value);
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
/**
* Sets leaf namespace and add itself to parent child schema map.
*
* @param nameSpace namespace
*/
public void setLeafNameSpaceAndAddToParentSchemaMap(YangNamespace nameSpace) {
setNameSpace(nameSpace);
// Process addition of leaf to schema node map.
((YangNode) getContainedIn()).processAdditionOfSchemaNodeToCurNodeMap(getName(), getNameSpace(), this);
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
@Override
public SchemaId getSchemaId() {
SchemaId schemaId = new SchemaId(getName(), getNameSpace()
.getModuleNamespace());
return schemaId;
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-parser
leaf.setName(identifier);
leaf.setLineNumber(line);
leaf.setCharPosition(charPositionInLine);
leaf.setFileName(listener.getFileName());
leaf.setConfig(parentConfig);
leavesHolder = (YangLeavesHolder) tmpData;
leavesHolder.addLeaf(leaf);
leaf.setContainedIn(leavesHolder);
if (tmpData instanceof YangList) {
YangList list = (YangList) tmpData;
for (String key : list.getKeyList()) {
if (key.equals(leaf.getName())) {
leaf.setKeyLeaf(true);
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
try {
((CollisionDetector) usesParent)
.detectCollidingChild(leaf.getName(), LEAF_DATA);
clonedLeaf = leaf.clone();
clonedLeaf.setReferredLeaf(leaf);
addUnresolvedType(this, clonedLeaf, (YangNode) usesParent);
} catch (CloneNotSupportedException | DataModelException e) {
clonedLeaf.setContainedIn(usesParent);
usesParent.addLeaf(clonedLeaf);
if (usesParent instanceof YangList) {
Set<String> keys = ((YangList) usesParent).getKeyLeaf();
if (keys.contains(clonedLeaf.getName())) {
clonedLeaf.setKeyLeaf(true);
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
try {
((CollisionDetector) dstNode)
.detectCollidingChild(leaf.getName(), LEAF_DATA);
clonedLeaf = leaf.cloneForDeviation();
clonedLeaf.setReferredLeaf(leaf);
} catch (CloneNotSupportedException | DataModelException e) {
throw new DataModelException(e.getMessage());
clonedLeaf.setContainedIn(destLeafHolder);
destLeafHolder.addLeaf(clonedLeaf);
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
/**
* Detects collision with list of leaf name and any comparable
* identifier.
*
* @param name comparable identifier
* @param info location info
* @param leaves list of leaf
*/
private static void detectLeafCollision(String name, LocationInfo info,
List<YangLeaf> leaves) {
if (leaves != null && !leaves.isEmpty()) {
for (YangLeaf leaf : leaves) {
detectCollision(leaf.getName(), name, info, TGT_LEAF);
}
}
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
if (leaves != null && !leaves.isEmpty()) {
for (YangLeaf leaf : leaves) {
if (key.equals(leaf.getName())) {
if (leaf.getDataType().getDataType() == EMPTY) {
throw new DataModelException(" A leaf that is part of the key must not be the built-in " +
"type \"empty\"." +
if (isConfig != keyLeaf.isConfig()) {
throw new DataModelException("All key leafs in a list must have the same value for their" +
" \"config\" as the list itself." +
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
if (currentListOfLeaves != null) {
for (YangLeaf leaf : currentListOfLeaves) {
if (leaf.getDataType().getDataType() == ENUMERATION
|| leaf.getDataType().getDataType() == UNION) {
try {
YangType<?> clonedType = leaf.getDataType().clone();
updateClonedTypeRef(clonedType, leavesHolder);
leaf.setDataType(clonedType);
} catch (DataModelException e) {
throw e;
log.error("Error in cloning", e);
throw new DataModelException("Could not clone Type node " +
leaf.getDataType().getDataTypeName() + " in " +
leaf.getDataType().getLineNumber() + " at " +
leaf.getDataType().getCharPosition() +
" in " + leaf.getDataType().getFileName() + "\"");
代码示例来源:origin: org.onosproject/onos-yang-compiler-parser
leaf.setContainedIn(logical);
if (logLeaves == null) {
logLeaves = new LinkedList<>();
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
YangType baseType = yangLeaf.getDataType();
YangLeafRef referredLeafRefInfo = (YangLeafRef) (yangLeaf.getDataType().getDataTypeExtendedInfo());
List<YangIfFeature> referredLeafIfFeatureList = yangLeaf.getIfFeatureList();
if (referredLeafIfFeatureList != null && !referredLeafIfFeatureList.isEmpty()) {
Iterator<YangIfFeature> referredLeafIfFeature = referredLeafIfFeatureList.iterator();
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
((YangLeaf) targetNode).setDataType(deviateReplace.getDataType());
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
/**
* Returns the leaf by searching it in the node by the leaf name. Returns
* null when the name doesn't match.
*
* @param name leaf name
* @param holder holder of leaf
* @return YANG leaf
*/
private static YangLeaf getLeaf(YangNodeIdentifier name,
YangLeavesHolder holder) {
List<YangLeaf> listOfLeaf = holder.getListOfLeaf();
if (listOfLeaf != null) {
for (YangLeaf yangLeaf : listOfLeaf) {
if (yangLeaf.getName().equals(name.getName())) {
return yangLeaf;
}
}
}
return null;
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-parser
case LEAF_DATA:
YangLeaf leaf = (YangLeaf) tmpData;
leaf.setDataType(type);
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
@Override
public YangSchemaNodeContextInfo getChildSchema(
YangSchemaNodeIdentifier dataNodeIdentifier)
throws DataModelException {
throw new DataModelException("leaf cannot have any child schema nodes " +
getName() + " in " +
getLineNumber() + " at " +
getCharPosition() +
" in " + getFileName() + "\"");
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
/**
* Searches for leaf/leaf-list in given leaf holder node.
*
* @param target leaf holder
* @param name leaf/leaf-list name
* @return leaf/leaf-list node
*/
public static YangSchemaNode findLeafNode(YangLeavesHolder target,
String name) {
List<YangLeaf> leaves = target.getListOfLeaf();
if (leaves != null && !leaves.isEmpty()) {
for (YangLeaf leaf : leaves) {
if (leaf.getName().equals(name)) {
return leaf;
}
}
}
List<YangLeafList> listOfleafList = target.getListOfLeafList();
if (listOfleafList != null && !listOfleafList.isEmpty()) {
for (YangLeafList leafList : listOfleafList) {
if (leafList.getName().equals(name)) {
return leafList;
}
}
}
return null;
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
/**
* Adds the unresolved constructs to stack which has to be resolved for leafref.
*
* @param leavesInfo YANG leaf or leaf list which holds the type
* @param ancestorRefNode holder of the YANG leaf or leaf list
*/
private void addUnResolvedLeafRefTypeToStack(T leavesInfo, YangNode ancestorRefNode) {
YangType refType;
T extendedInfo;
if (leavesInfo instanceof YangLeaf) {
YangLeaf leaf = (YangLeaf) leavesInfo;
refType = leaf.getDataType();
} else {
YangLeafList leafList = (YangLeafList) leavesInfo;
refType = leafList.getDataType();
}
extendedInfo = (T) refType.getDataTypeExtendedInfo();
addUnResolvedTypeDataToStack(refType, ancestorRefNode, extendedInfo);
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
/**
* Detects the colliding identifier name in a given leaf node.
*
* @param listOfLeaf List of leaves to detect collision
* @param identifierName name for which collision detection is to be checked
* @throws DataModelException a violation of data model rules
*/
private static void detectCollidingLeaf(List<YangLeaf> listOfLeaf, String identifierName)
throws DataModelException {
if (listOfLeaf == null) {
return;
}
for (YangLeaf leaf : listOfLeaf) {
if (leaf.getName().equals(identifierName)) {
throw new DataModelException("YANG file error: Duplicate input identifier detected, same as leaf \"" +
leaf.getName() + " in " +
leaf.getLineNumber() + " at " +
leaf.getCharPosition() +
" in " + leaf.getFileName() + "\"");
}
}
}
内容来源于网络,如有侵权,请联系作者删除!