本文整理了Java中org.onosproject.yang.compiler.datamodel.YangUses
类的一些代码示例,展示了YangUses
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangUses
类的具体详情如下:
包路径:org.onosproject.yang.compiler.datamodel.YangUses
类名称:YangUses
[英]Represents data model node to maintain information defined in YANG uses.
[中]表示数据模型节点,以维护数据模型中定义的信息。
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
@Override
public void detectSelfCollision(String identifierName, YangConstructType dataType)
throws DataModelException {
if (getName().equals(identifierName)) {
throw new DataModelException(
getErrorMsgCollision(COLLISION_DETECTION, getName(),
getLineNumber(), getCharPosition(),
USES, getFileName()));
}
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
/**
* Adds all the unresolved type under leaf/leaf-list to the resolution
* list, after cloning. This makes the resolution to happen after cloning
* of the grouping. Adds resolution with cloned node holder under which
* cloned type is present.
*
* @param yangUses YANG uses
* @param clonedObj cloned type object
* @param clonedNode holder node
* @throws DataModelException data model error
*/
public static void addUnresolvedType(
YangUses yangUses, Object clonedObj,
YangNode clonedNode) throws DataModelException {
List<YangEntityToResolveInfoImpl> infoList;
if (yangUses != null && yangUses.getCurrentGroupingDepth() == 0) {
infoList = getTypesToBeResolved(clonedObj, clonedNode, yangUses);
if (nonEmpty(infoList)) {
yangUses.addEntityToResolve(infoList);
}
}
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
/**
* Gets the list of augments from the uses.
*
* @param uses YANG uses
* @return list of YANG augment
*/
private List<YangAugment> getAugList(YangUses uses) {
List<YangAugment> augList = new LinkedList<>();
YangNode child = uses.getChild();
while (child != null) {
if (child instanceof YangAugment) {
augList.add((YangAugment) child);
}
child = child.getNextSibling();
}
return augList;
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
throws DataModelException {
YangGrouping referredGrouping = getRefGroup();
" uses " + getName() + " in " +
getLineNumber() + " at " +
getCharPosition() + " in " +
getFileName() + "\"");
} else {
if (checkIsUnresolvedRecursiveUsesInGrouping(referredGrouping)) {
return null;
|| !(usesParentNode instanceof CollisionDetector)) {
throw new DataModelException(
"YANG uses holder construct is wrong " + getName() + " in " +
getLineNumber() + " at " + getCharPosition() +
" in " + getFileName() + "\"");
cloneGroupingTree(referredGrouping, usesParentNode, this, false);
} catch (DataModelException e) {
throw new DataModelException(e.getMessage());
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
/**
* Finds the referred grouping node at the root level of imported/included node.
*
* @param refNode module/sub-module node
* @return referred grouping
*/
private YangNode findRefGrouping(YangNode refNode) {
YangNode tmpNode = refNode.getChild();
while (tmpNode != null) {
if (tmpNode instanceof YangGrouping) {
if (tmpNode.getName()
.equals(((YangUses) getCurEntityToResolveFromStack())
.getName())) {
return tmpNode;
}
}
tmpNode = tmpNode.getNextSibling();
}
return null;
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
/**
* Returns referred typedef/grouping node.
*
* @return referred typedef/grouping node
* @throws DataModelException a violation in data model rule
*/
private T getRefNode() throws DataModelException {
T entity = getCurEntityToResolveFromStack();
if (entity instanceof YangType) {
YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>)
((YangType<?>) entity).getDataTypeExtendedInfo();
return (T) derivedInfo.getReferredTypeDef();
}
if (entity instanceof YangUses) {
return (T) ((YangUses) entity).getRefGroup();
}
if (entity instanceof YangIfFeature) {
return (T) ((YangIfFeature) entity).getReferredFeatureHolder();
}
if (entity instanceof YangLeafRef) {
return (T) ((YangLeafRef) entity).getReferredLeafOrLeafList();
}
if (entity instanceof YangBase) {
return (T) ((YangBase) entity).getReferredIdentity();
}
if (entity instanceof YangIdentityRef) {
return (T) ((YangIdentityRef) entity).getReferredIdentity();
}
throw new DataModelException(LINKER_ERROR);
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
return node.getName().contentEquals(((YangUses) entity).getName());
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
/**
* Adds the resolved augment from the cloned uses.
*
* @param uses YANG uses
* @param aug cloned augment
* @throws DataModelException data model error
*/
public static void addUnresolvedAugment(YangUses uses, YangAugment aug)
throws DataModelException {
if (uses.getCurrentGroupingDepth() == 0) {
List<YangEntityToResolveInfoImpl> infoList = new LinkedList<>();
YangEntityToResolveInfoImpl info =
new YangEntityToResolveInfoImpl<>();
aug.setResolvableStatus(UNRESOLVED);
info.setEntityToResolve(aug);
info = setInformationInEntity(info, aug.getParent(),
aug.getCharPosition(),
aug.getLineNumber());
infoList.add(info);
uses.addEntityToResolve(infoList);
}
}
内容来源于网络,如有侵权,请联系作者删除!