本文整理了Java中org.onosproject.yangutils.datamodel.YangModule.getImportList()
方法的一些代码示例,展示了YangModule.getImportList()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangModule.getImportList()
方法的具体详情如下:
包路径:org.onosproject.yangutils.datamodel.YangModule
类名称:YangModule
方法名:getImportList
[英]Returns the list of imported modules.
[中]返回导入模块的列表。
代码示例来源:origin: org.onosproject/onos-yang-datamodel
@Override
public void addReferencesToImportList(Set<YangNode> yangNodeSet)
throws DataModelException {
// Run through the imported list to add references.
for (YangImport yangImport : getImportList()) {
yangImport.addReferenceToImport(yangNodeSet);
}
}
代码示例来源:origin: org.onosproject/onos-yang-datamodel
/**
* Assigns leafref with new prefixes while cloning.
*
* @param importedNodeName imported node name from grouping
* @param atomicPath atomic path in leafref
* @param node instance of YANG uses where cloning is done
* @throws DataModelException data model error
*/
private static void assignCurrentLeafedWithNewPrefixes(String importedNodeName, YangAtomicPath atomicPath,
YangNode node)
throws DataModelException {
while (!(node instanceof YangReferenceResolver)) {
node = node.getParent();
if (node == null) {
throw new DataModelException("Internal datamodel error: Datamodel tree is not correct");
}
}
if (node instanceof YangModule) {
List<YangImport> importInUsesList = ((YangModule) node).getImportList();
if (importInUsesList != null && !importInUsesList.isEmpty()) {
Iterator<YangImport> importInUsesListIterator = importInUsesList.listIterator();
while (importInUsesListIterator.hasNext()) {
YangImport importInUsesNode = importInUsesListIterator.next();
if (importInUsesNode.getModuleName().equals(importedNodeName)) {
atomicPath.getNodeIdentifier().setPrefix(importInUsesNode.getPrefixId());
}
}
}
}
}
代码示例来源:origin: org.onosproject/onos-yang-utils-parser
/**
* Validates the prefix of the YANG file where leaf-ref is present and
* puts it in the map of node and prefix in leaf-ref.
*
* @param atomicList atomic content list in leaf-ref
* @param leafRef YANG leaf-ref
*/
private static void valPrefix(List<YangAtomicPath> atomicList,
YangLeafRef leafRef) {
for (YangAtomicPath atomicPath : atomicList) {
String prefix = atomicPath.getNodeIdentifier().getPrefix();
YangNode parent = leafRef.getParentNode();
YangNode rootNode = getRootNode(parent);
List<YangImport> imports;
if (rootNode instanceof YangModule) {
imports = ((YangModule) rootNode).getImportList();
} else {
imports = ((YangSubModule) rootNode).getImportList();
}
updatePrefixWithNode(rootNode, imports, prefix, leafRef);
}
}
内容来源于网络,如有侵权,请联系作者删除!