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

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

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

YangLeaf.getName介绍

[英]Retrieve the name of leaf.
[中]检索leaf的名称。

代码示例

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

@Override
public SchemaId getSchemaId() {
  SchemaId schemaId = new SchemaId(getName(), getNameSpace()
      .getModuleNamespace());
  return schemaId;
}

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

/**
 * Detects collision with list of leaf name and any comparable
 * identifier.
 *
 * @param name   comparable identifier
 * @param info   location info
 * @param leaves list of leaf
 */
private static void detectLeafCollision(String name, LocationInfo info,
                    List<YangLeaf> leaves) {
  if (leaves != null && !leaves.isEmpty()) {
    for (YangLeaf leaf : leaves) {
      detectCollision(leaf.getName(), name, info, TGT_LEAF);
    }
  }
}

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

/**
 * Sets leaf namespace and add itself to parent child schema map.
 *
 * @param nameSpace namespace
 */
public void setLeafNameSpaceAndAddToParentSchemaMap(YangNamespace nameSpace) {
  setNameSpace(nameSpace);
  // Process addition of leaf to schema node map.
  ((YangNode) getContainedIn()).processAdditionOfSchemaNodeToCurNodeMap(getName(), getNameSpace(), this);
}

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

/**
 * Detects the colliding identifier name in a given leaf node.
 *
 * @param listOfLeaf     List of leaves to detect collision
 * @param identifierName name for which collision detection is to be checked
 * @throws DataModelException a violation of data model rules
 */
private static void detectCollidingLeaf(List<YangLeaf> listOfLeaf, String identifierName)
    throws DataModelException {
  if (listOfLeaf == null) {
    return;
  }
  for (YangLeaf leaf : listOfLeaf) {
    if (leaf.getName().equals(identifierName)) {
      throw new DataModelException("YANG file error: Duplicate input identifier detected, same as leaf \"" +
                         leaf.getName() + " in " +
                         leaf.getLineNumber() + " at " +
                         leaf.getCharPosition() +
                         " in " + leaf.getFileName() + "\"");
    }
  }
}

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

/**
 * Detects collision between augment's leaves and leaf lists' identifier
 * with target node leaves and leaf lists' identifier.
 *
 * @param tL  target leaves
 * @param tLl target leaf lists
 * @param aL  augment leaves
 * @param aLl augment leaf lists
 */
private static void detectLeavesCollision(List<YangLeaf> tL,
                     List<YangLeafList> tLl,
                     List<YangLeaf> aL,
                     List<YangLeafList> aLl) {
  if (aL != null && !aL.isEmpty()) {
    for (YangLeaf aLeaf : aL) {
      detectLeafCollision(aLeaf.getName(), aLeaf, tL);
      detectLeafListCollision(aLeaf.getName(), aLeaf, tLl);
    }
  }
  if (aLl != null && !aLl.isEmpty()) {
    for (YangLeafList aLeafList : aLl) {
      detectLeafCollision(aLeafList.getName(), aLeafList, tL);
      detectLeafListCollision(aLeafList.getName(), aLeafList, tLl);
    }
  }
}

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

@Override
public int getMandatoryChildCount()
    throws DataModelException {
  throw new DataModelException("Leaf can't have child. " +
                     getName() + " in " +
                     getLineNumber() + " at " +
                     getCharPosition() +
                     " in " + getFileName() + "\"");
}

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

@Override
public YangSchemaNodeContextInfo getChildSchema(
    YangSchemaNodeIdentifier dataNodeIdentifier)
    throws DataModelException {
  throw new DataModelException("leaf cannot have any child schema nodes " +
                     getName() + " in " +
                     getLineNumber() + " at " +
                     getCharPosition() +
                     " in " + getFileName() + "\"");
}

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

if (leaves != null && !leaves.isEmpty()) {
  for (YangLeaf leaf : leaves) {
    if (key.equals(leaf.getName())) {
      if (leaf.getDataType().getDataType() == EMPTY) {
        throw new DataModelException(" A leaf that is part of the key must not be the built-in " +

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

bitsNode.setBitsName(((YangLeaf) tmpData).getName());
  break;
case LEAF_LIST_DATA:

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

case LEAF_DATA:
  unionNode.setName(((YangLeaf) tmpData).getName() + UNION_CLASS_SUFFIX);

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

for (YangLeaf leaf : augment.getListOfLeaf()) {
  YangCase javaCase = getYangCaseNode(JAVA_GENERATION);
  javaCase.setName(leaf.getName());
  javaCase.addLeaf(leaf);
  augment.addChild(javaCase);

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

YangList list = (YangList) tmpData;
for (String key : list.getKeyList()) {
  if (key.equals(leaf.getName())) {
    leaf.setKeyLeaf(true);

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

try {
  ((CollisionDetector) usesParent)
      .detectCollidingChild(leaf.getName(), LEAF_DATA);
  clonedLeaf = leaf.clone();
  clonedLeaf.setReferredLeaf(leaf);
if (usesParent instanceof YangList) {
  Set<String> keys = ((YangList) usesParent).getKeyLeaf();
  if (keys.contains(clonedLeaf.getName())) {
    clonedLeaf.setKeyLeaf(true);

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

try {
  ((CollisionDetector) dstNode)
      .detectCollidingChild(leaf.getName(), LEAF_DATA);
  clonedLeaf = leaf.cloneForDeviation();
  clonedLeaf.setReferredLeaf(leaf);

相关文章