本文整理了Java中org.onosproject.yang.compiler.datamodel.YangNodeIdentifier.getPrefix()
方法的一些代码示例,展示了YangNodeIdentifier.getPrefix()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangNodeIdentifier.getPrefix()
方法的具体详情如下:
包路径:org.onosproject.yang.compiler.datamodel.YangNodeIdentifier
类名称:YangNodeIdentifier
方法名:getPrefix
[英]Returns prefix of the node identifier.
[中]返回节点标识符的前缀。
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
/**
* Returns prefix associated with identifier.
*
* @return prefix associated with identifier
*/
public String getPrefix() {
return name.getPrefix();
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
/**
* Returns prefix associated with data type name.
*
* @return prefix associated with data type name
*/
public String getPrefix() {
return nodeId.getPrefix();
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
/**
* Returns prefix associated with base.
*
* @return prefix associated with base
*/
public String getPrefix() {
return baseIdentity.getPrefix();
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
/**
* Returns prefix associated with uses.
*
* @return prefix associated with uses
*/
public String getPrefix() {
return nodeIdentifier.getPrefix();
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
/**
* Returns target node when leaf-ref has only one absolute path in list.
*
* @param paths absolute paths
* @return target node
*/
private YangNode getTargetNodeWhenPathSizeIsOne(List<YangAtomicPath> paths) {
if (paths.get(0).getNodeIdentifier().getPrefix() != null &&
!paths.get(0).getNodeIdentifier().getPrefix().equals(
getRootsPrefix(rootNode))) {
return getImportedNode(rootNode, paths.get(0).getNodeIdentifier());
}
return rootNode;
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
prePrefix = curPrefix;
absPath = pathIterator.next();
curPrefix = absPath.getNodeIdentifier().getPrefix();
if (curPrefix != null && !(curPrefix.equals(rootPrefix))) {
if (!curPrefix.equals(prePrefix)) {
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
/**
* Converts the prefixes in all the nodes of the leafref with respect to the uses node.
*
* @param leafrefForCloning leafref that is to be cloned
* @param yangUses instance of YANG uses where cloning is done
* @throws DataModelException data model error
*/
private static void convertThePrefixesDuringChange(YangLeafRef leafrefForCloning, YangUses yangUses)
throws DataModelException {
List<YangAtomicPath> atomicPathList = leafrefForCloning.getAtomicPath();
if (atomicPathList != null && !atomicPathList.isEmpty()) {
Iterator<YangAtomicPath> atomicPathIterator = atomicPathList.listIterator();
while (atomicPathIterator.hasNext()) {
YangAtomicPath atomicPath = atomicPathIterator.next();
Map<String, String> prefixesAndItsImportNameNode = leafrefForCloning.getPrefixAndNode();
String prefixInPath = atomicPath.getNodeIdentifier().getPrefix();
String importedNodeName = prefixesAndItsImportNameNode.get(prefixInPath);
assignCurrentLeafedWithNewPrefixes(importedNodeName, atomicPath, yangUses);
}
}
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-parser
/**
* Returns the augment name, after removing the prefix, in each atomic
* content, which is equal to the root prefix.
*
* @param atomics atomic content list
* @param root root node
* @return prefix removed augment name
*/
public static String getPrefixRemovedName(List<YangAtomicPath> atomics,
YangNode root) {
String rootPrefix = getRootPrefix(root);
StringBuilder builder = new StringBuilder();
for (YangAtomicPath atomic : atomics) {
String id;
String prefix = atomic.getNodeIdentifier().getPrefix();
String name = atomic.getNodeIdentifier().getName();
if (rootPrefix.equals(prefix) || prefix == null) {
id = SLASH_FOR_STRING + name;
} else {
id = SLASH_FOR_STRING + prefix + COLON + name;
}
builder.append(id);
}
return builder.toString();
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
/**
* Process linking using import list.
*
* @param root root node
* @param nodeId node identifier
* @return linked target node
*/
private YangNode getImportedNode(YangNode root, YangNodeIdentifier nodeId) {
List<YangImport> importList;
if (root instanceof YangModule) {
importList = ((YangModule) root).getImportList();
} else {
importList = ((YangSubModule) root).getImportList();
}
for (YangImport imported : importList) {
if (imported.getPrefixId().equals(nodeId.getPrefix())) {
return imported.getImportedNode();
}
}
if (nodeId.getName() != null && nodeId.getPrefix()
.equals(constructsParentsPrefix)) {
return rootNode;
}
return root;
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
/**
* Process linking using for node identifier for inter/intra file.
*
* @param root root node
* @return linked target node
*/
private YangNode parseData(YangNode root) {
String rootPrefix = getRootsPrefix(root);
constructsParentsPrefix = rootPrefix;
Iterator<YangAtomicPath> pathIterator = absPaths.iterator();
YangAtomicPath path = pathIterator.next();
if (path.getNodeIdentifier().getPrefix() != null
&& !path.getNodeIdentifier().getPrefix().equals(rootPrefix)) {
return parsePath(getImportedNode(root, path.getNodeIdentifier()));
} else {
return parsePath(root);
}
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
YangNode node = augment.getAugmentedNode();
for (YangAtomicPath atomicPath : augment.getTargetNode()) {
if (atomicPath.getNodeIdentifier().getPrefix() != null &&
!atomicPath.getNodeIdentifier().getPrefix().equals(EMPTY_STRING)) {
listOfPathName.add(atomicPath.getNodeIdentifier().getPrefix()
+ COLON + atomicPath.getNodeIdentifier().getName());
} else {
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
tempNodeId = nodeIdIterator.next();
name = tempNodeId.getNodeIdentifier().getName();
prefix = tempNodeId.getNodeIdentifier().getPrefix();
if (!tempNodeId.getNodeIdentifier().equals(nodeId)) {
type = prefixResolverTypes.get(tempNodeId);
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
.getEntityToResolveInfo().getEntityToResolve();
YangAtomicPath atomic = firstDeviation.getTargetNode().get(0);
prefix = atomic.getNodeIdentifier().getPrefix();
List<YangAtomicPath> targetNode = deviation.getTargetNode();
YangAtomicPath atomicPath = targetNode.get(0);
if (!atomicPath.getNodeIdentifier().getPrefix().equals(prefix)) {
throw new DataModelException("YANG FILE ERROR : Deviations " +
"of multiple module is" +
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
YangAtomicPath tempPath = pathIterator.next();
YangNodeIdentifier nodeId;
curPrefix = tempPath.getNodeIdentifier().getPrefix();
int index = 0;
YangNode tempAugment;
do {
nodeId = tempPath.getNodeIdentifier();
if (tempPath.getNodeIdentifier().getPrefix() == null) {
tempAugment = resolveIntraFileAugment(tempPath, root);
} else {
if (!tempPath.getNodeIdentifier().getPrefix().equals(curPrefix)) {
curPrefix = tempPath.getNodeIdentifier().getPrefix();
root = getImportedNode(rootNode, tempPath.getNodeIdentifier());
代码示例来源:origin: org.onosproject/onos-yang-compiler-parser
atomicPath.setNodeIdentifier(id);
pathList.add(atomicPath);
if (id.getPrefix() != null &&
!id.getPrefix().equals(prefix)) {
ParserException exc = new ParserException(E_DES_NODE);
exc.setLine(ctx.getStart().getLine());
代码示例来源:origin: org.onosproject/onos-yang-compiler-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);
}
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
/**
* Returns the referenced prefix of entity under resolution.
*
* @return referenced prefix of entity under resolution
* @throws DataModelException a violation in data model rule
*/
private String getRefPrefix()
throws DataModelException {
T entity = getCurEntityToResolveFromStack();
if (entity instanceof YangType) {
return ((YangType<?>) entity).getPrefix();
}
if (entity instanceof YangUses) {
return ((YangUses) entity).getPrefix();
}
if (entity instanceof YangIfFeature) {
return ((YangIfFeature) entity).getPrefix();
}
if (entity instanceof YangBase) {
return ((YangBase) entity).getBaseIdentifier()
.getPrefix();
}
if (entity instanceof YangIdentityRef) {
return ((YangIdentityRef) entity).getPrefix();
}
throw new DataModelException(LINKER_ERROR);
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
if (curPrefix != tempPath.getNodeIdentifier().getPrefix()) {
root = getIncludedNode(rootNode, tempPath.getNodeIdentifier().getName());
if (root == null) {
curPrefix = tempPath.getNodeIdentifier().getPrefix();
tempAugment = getAugment(tempPath.getNodeIdentifier(), root, absPaths);
if (tempAugment == null) {
内容来源于网络,如有侵权,请联系作者删除!