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

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

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

YangLeavesHolder.getListOfLeaf介绍

[英]Returns the list of leaves from data holder like container / list.
[中]

代码示例

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

/**
 * Sets provided context as parent context for module/submodule and case
 * nodes.
 *
 * @param context module registry schema context
 */
public void setLeafRootContext(SchemaContext context) {
  // Add parent context for all leafs.
  for (YangLeaf yangLeaf : ((YangLeavesHolder) this).getListOfLeaf()) {
    yangLeaf.setParentContext(context);
  }
  // Add parent context for all leaf list.
  for (YangLeafList yangLeafList : ((YangLeavesHolder) this)
      .getListOfLeafList()) {
    yangLeafList.setParentContext(context);
  }
}

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

/**
 * Returns the leaf by searching it in the node by the leaf name. Returns
 * null when the name doesn't match.
 *
 * @param name   leaf name
 * @param holder holder of leaf
 * @return YANG leaf
 */
private static YangLeaf getLeaf(YangNodeIdentifier name,
                YangLeavesHolder holder) {
  List<YangLeaf> listOfLeaf = holder.getListOfLeaf();
  if (listOfLeaf != null) {
    for (YangLeaf yangLeaf : listOfLeaf) {
      if (yangLeaf.getName().equals(name.getName())) {
        return yangLeaf;
      }
    }
  }
  return null;
}

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

/**
 * Searches for leaf/leaf-list in given leaf holder node.
 *
 * @param target leaf holder
 * @param name   leaf/leaf-list name
 * @return leaf/leaf-list node
 */
public static YangSchemaNode findLeafNode(YangLeavesHolder target,
                     String name) {
  List<YangLeaf> leaves = target.getListOfLeaf();
  if (leaves != null && !leaves.isEmpty()) {
    for (YangLeaf leaf : leaves) {
      if (leaf.getName().equals(name)) {
        return leaf;
      }
    }
  }
  List<YangLeafList> listOfleafList = target.getListOfLeafList();
  if (listOfleafList != null && !listOfleafList.isEmpty()) {
    for (YangLeafList leafList : listOfleafList) {
      if (leafList.getName().equals(name)) {
        return leafList;
      }
    }
  }
  return null;
}

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

/**
 * Returns the leaf from leaves holder.
 *
 * @param holder root node from where it starts searching
 * @param pLeaf  yang atomic path
 * @return yang leaf from leaves holder
 */
private static YangLeaf getLeaf(YangNode holder, YangAtomicPath pLeaf) {
  YangLeavesHolder leavesHolder = (YangLeavesHolder) holder;
  List<YangLeaf> leaves = leavesHolder.getListOfLeaf();
  if (leaves != null && !leaves.isEmpty()) {
    for (YangLeaf leaf : leaves) {
      if (pLeaf.getNodeIdentifier().getName()
          .equals(leaf.getName())) {
        return leaf;
      }
    }
  }
  return null;
}

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

/**
 * Searches target leaf in root node.
 *
 * @param node      root node
 * @param curNodeId YANG node identifier
 * @return linked target leaf node holder
 */
private YangNode searchTargetLeaf(YangNode node,
                 YangNodeIdentifier curNodeId) {
  YangLeavesHolder holder = (YangLeavesHolder) node;
  List<YangLeafList> leavesList = holder.getListOfLeafList();
  if (leavesList != null && !leavesList.isEmpty()) {
    for (YangLeafList leafList : leavesList) {
      if (leafList.getName().equals(curNodeId.getName())) {
        return node;
      }
    }
  }
  List<YangLeaf> leaves = holder.getListOfLeaf();
  if (leaves != null && !leaves.isEmpty()) {
    for (YangLeaf leaf : leaves) {
      if (leaf.getName().equals(curNodeId.getName())) {
        return node;
      }
    }
  }
  return null;
}

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

/**
 * Searches for the referred leaf in target node.
 *
 * @param targetNode target node
 * @param leafName   leaf name
 * @return target leaf
 */
private YangLeaf searchReferredLeaf(YangNode targetNode, String leafName) {
  if (!(targetNode instanceof YangLeavesHolder)) {
    throw new LinkerException(getErrorMsg(
        LEAF_HOLDER_ERROR, targetNode.getName(), targetNode
            .getLineNumber(), targetNode.getCharPosition(),
        targetNode.getFileName()));
  }
  YangLeavesHolder holder = (YangLeavesHolder) targetNode;
  List<YangLeaf> leaves = holder.getListOfLeaf();
  if (leaves != null && !leaves.isEmpty()) {
    for (YangLeaf leaf : leaves) {
      if (leaf.getName().equals(leafName)) {
        return leaf;
      }
    }
  }
  return null;
}

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

/**
 * Removes leaf/leaf-list from data model tree.
 *
 * @param node     YANG data model node
 * @param leafName name of leaf to be removed
 */
public static void deleteUnsupportedLeafOrLeafList(YangLeavesHolder node,
                          String leafName) {
  List<YangLeaf> leaves = node.getListOfLeaf();
  if (leaves != null && !leaves.isEmpty()) {
    for (YangLeaf leaf : leaves) {
      if (leaf.getName().equals(leafName)) {
        node.removeLeaf(leaf);
        return;
      }
    }
  }
  List<YangLeafList> leafList = node.getListOfLeafList();
  if (leafList != null && !leafList.isEmpty()) {
    for (YangLeafList leaf : leafList) {
      if (leaf.getName().equals(leafName)) {
        node.removeLeafList(leaf);
        return;
      }
    }
  }
}

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

throws CloneNotSupportedException, DataModelException {
List<YangLeaf> leaves = clonedNode.getListOfLeaf();
if (nonEmpty(leaves)) {
  List<YangLeaf> clonedLeaves = new LinkedList<>();

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

/**
 * Detects the colliding identifier name in a given YANG node and its child.
 *
 * @param identifierName name for which collision detection is to be checked
 * @param dataType       type of YANG node asking for detecting collision
 * @param node           instance of calling node
 * @throws DataModelException a violation of data model rules
 */
public static void detectCollidingChildUtil(String identifierName, YangConstructType dataType, YangNode node)
    throws DataModelException {
  if (dataType == YangConstructType.USES_DATA || dataType == YangConstructType.GROUPING_DATA) {
    detectCollidingForUsesGrouping(identifierName, dataType, node);
  } else {
    if (node instanceof YangLeavesHolder) {
      YangLeavesHolder leavesHolder = (YangLeavesHolder) node;
      detectCollidingLeaf(leavesHolder.getListOfLeaf(), identifierName);
      detectCollidingLeafList(leavesHolder.getListOfLeafList(), identifierName);
    }
    node = node.getChild();
    while (node != null) {
      Parsable parsable = (Parsable) node;
      if (node instanceof CollisionDetector
          && parsable.getYangConstructType() != YangConstructType.USES_DATA
          && parsable.getYangConstructType() != YangConstructType.GROUPING_DATA) {
        ((CollisionDetector) node).detectSelfCollision(identifierName, dataType);
      }
      node = node.getNextSibling();
    }
  }
}

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

tL = ((YangLeavesHolder) tgt).getListOfLeaf();
tLl = ((YangLeavesHolder) tgt).getListOfLeafList();

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

if (srcLeafHolder.getListOfLeaf() != null) {
  for (YangLeaf leaf : srcLeafHolder.getListOfLeaf()) {
    YangLeaf clonedLeaf;
    try {

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

if (leavesHolder.getListOfLeaf() != null && !leavesHolder.getListOfLeaf().isEmpty()) {
  for (YangLeaf leaf : leavesHolder.getListOfLeaf()) {
    YangType type = leaf.getDataType();
    if (type.getDataType() == DERIVED) {

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

List<YangLeaf> currentListOfLeaves = leavesHolder.getListOfLeaf();
if (currentListOfLeaves != null) {
  for (YangLeaf leaf : currentListOfLeaves) {

相关文章