org.onosproject.yang.compiler.datamodel.YangNodeIdentifier.setPrefix()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(87)

本文整理了Java中org.onosproject.yang.compiler.datamodel.YangNodeIdentifier.setPrefix()方法的一些代码示例,展示了YangNodeIdentifier.setPrefix()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangNodeIdentifier.setPrefix()方法的具体详情如下:
包路径:org.onosproject.yang.compiler.datamodel.YangNodeIdentifier
类名称:YangNodeIdentifier
方法名:setPrefix

YangNodeIdentifier.setPrefix介绍

[英]Sets prefix of the node identifier.
[中]设置节点标识符的前缀。

代码示例

代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel

/**
 * Sets prefix associated with identifier.
 *
 * @param prefix prefix associated with identifier
 */
public void setPrefix(String prefix) {
  name.setPrefix(prefix);
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel

/**
 * Get prefix associated with uses.
 *
 * @param prefix prefix associated with uses
 */
public void setPrefix(String prefix) {
  nodeIdentifier.setPrefix(prefix);
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel

/**
 * Sets prefix associated with data type name.
 *
 * @param prefix prefix associated with data type name
 */
public void setPrefix(String prefix) {
  nodeId.setPrefix(prefix);
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel

/**
 * Sets prefix associated with base.
 *
 * @param prefix prefix associated with base
 */
public void setPrefix(String prefix) {
  baseIdentity.setPrefix(prefix);
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-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-compiler-linker

/**
 * Checks and return valid node identifier.
 *
 * @param nodeIdentifierString string from yang file
 * @param yangConstruct        yang construct for creating error message
 * @return valid node identifier
 */
static YangNodeIdentifier getValidNodeIdentifier(String nodeIdentifierString,
                         YangConstructType yangConstruct) {
  String[] tmpData = nodeIdentifierString.split(Pattern.quote(COLON));
  if (tmpData.length == 1) {
    YangNodeIdentifier nodeIdentifier = new YangNodeIdentifier();
    nodeIdentifier.setName(getValidIdentifier(tmpData[0], yangConstruct));
    return nodeIdentifier;
  } else if (tmpData.length == 2) {
    YangNodeIdentifier nodeIdentifier = new YangNodeIdentifier();
    nodeIdentifier.setPrefix(getValidIdentifier(tmpData[0], yangConstruct));
    nodeIdentifier.setName(getValidIdentifier(tmpData[1], yangConstruct));
    return nodeIdentifier;
  } else {
    throw new LinkerException("YANG file error : " +
                     getYangConstructType(yangConstruct) + " name " +
                     nodeIdentifierString + " is not valid.");
  }
}

代码示例来源:origin: org.onosproject/onos-yang-compiler-parser

} else if (tmpData.length == 2) {
  YangNodeIdentifier nodeIdentifier = new YangNodeIdentifier();
  nodeIdentifier.setPrefix(getValidIdentifier(tmpData[0], yangConstruct, ctx));
  nodeIdentifier.setName(getValidIdentifier(tmpData[1], yangConstruct, ctx));
  return nodeIdentifier;

相关文章