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

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

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

YangLeavesHolder.getListOfLeafList介绍

[英]Returns the list of leaf-list from data holder like container / list.
[中]从数据持有者(如容器/列表)返回叶列表的列表。

代码示例

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

/**
 * Returns the leaf-list by searching it in the node by the leaf-list name.
 * Returns null when the name doesn't match.
 *
 * @param name   leaf-list name
 * @param holder holder of leaf-list
 * @return YANG leaf-list
 */
private static YangLeafList getLeafList(YangNodeIdentifier name,
                    YangLeavesHolder holder) {
  List<YangLeafList> listOfLeafList = holder.getListOfLeafList();
  if (listOfLeafList != null) {
    for (YangLeafList yangLeafList : listOfLeafList) {
      if (yangLeafList.getName().equals(name.getName())) {
        return yangLeafList;
      }
    }
  }
  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

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

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

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

throws CloneNotSupportedException, DataModelException {
List<YangLeafList> listOfLeafList = clonedNode.getListOfLeafList();
if (nonEmpty(listOfLeafList)) {
  List<YangLeafList> clonedList = 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

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

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

if (srcLeafHolder.getListOfLeafList() != null) {
  for (YangLeafList leafList : srcLeafHolder.getListOfLeafList()) {
    YangLeafList clonedLeafList;
    try {

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

if (leavesHolder.getListOfLeafList() != null && !leavesHolder.getListOfLeafList().isEmpty()) {
  for (YangLeafList leafList : leavesHolder.getListOfLeafList()) {
    YangType type = leafList.getDataType();
    if (type.getDataType() == DERIVED) {

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

List<YangLeafList> currentListOfLeafList = leavesHolder.getListOfLeafList();
if (currentListOfLeafList != null) {
  for (YangLeafList leafList : currentListOfLeafList) {

相关文章