org.onosproject.yang.compiler.datamodel.YangNodeIdentifier类的使用及代码示例

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

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

YangNodeIdentifier介绍

[英]Represents YANG node identifier which is a combination of prefix and name.
[中]表示节点标识符,它是前缀和名称的组合。

代码示例

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

/**
 * Creates a YANG type object.
 */
public YangType() {
  nodeId = new YangNodeIdentifier();
  resolvableStatus = UNRESOLVED;
}

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

/**
 * Returns the name of data type.
 *
 * @return the name of data type
 */
public String getDataTypeName() {
  return nodeId.getName();
}

代码示例来源: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-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

/**
 * 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-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 the name of the data type.
 *
 * @param typeName the name to set
 */
public void setDataTypeName(String typeName) {
  nodeId.setName(typeName);
}

代码示例来源: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-parser

String[] tmpData = tmpIdentifierString.split(Pattern.quote(COLON));
if (tmpData.length == 1) {
  YangNodeIdentifier nodeIdentifier = new YangNodeIdentifier();
  nodeIdentifier.setName(getValidIdentifier(tmpData[0], yangConstruct, ctx));
  return nodeIdentifier;
} 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;
} else {

代码示例来源: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

/**
 * Sets the name of identity.
 *
 * @param name the identity name to set
 */
@Override
public void setName(String name) {
  baseIdentity.setName(name);
}

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

/**
 * Returns the name of identity.
 *
 * @return the identity name
 */
@Override
public String getName() {
  return baseIdentity.getName();
}

代码示例来源: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 {
    listOfPathName.add(atomicPath.getNodeIdentifier().getName());

代码示例来源: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

/**
 * 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

/**
 * Resets the class attributes to its default value.
 */
public void resetYangType() {
  nodeId = new YangNodeIdentifier();
  resolvableStatus = UNRESOLVED;
  dataType = null;
  dataTypeExtendedInfo = null;
}

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

@Override
public void setName(String name) {
  nodeIdentifier.setName(name);
}

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

@Override
public String getName() {
  return nodeIdentifier.getName();
}

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

while (nodeIdIterator.hasNext()) {
  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

/**
 * Returns prefix associated with base.
 *
 * @return prefix associated with base
 */
public String getPrefix() {
  return baseIdentity.getPrefix();
}

相关文章