gpt4 book ai didi

org.onosproject.yangutils.datamodel.YangLeaf类的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 13:05:31 25 4
gpt4 key购买 nike

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

YangLeaf介绍

[英]Represents leaf data represented in YANG.
[中]表示以YANG表示的叶数据。

代码示例

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

@Override
public void isValueValid(String value)
    throws DataModelException {
  getDataType().isValidValue(value);
}

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

@Override
public void addIfFeatureList(YangIfFeature ifFeature) {
  if (getIfFeatureList() == null) {
    setIfFeatureList(new LinkedList<>());
  }
  getIfFeatureList().add(ifFeature);
}

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

leaf.setName(identifier);
leaf.setLineNumber(line);
leaf.setCharPosition(charPositionInLine);
leaf.setFileName(listener.getFileName());
  leaf.setConfig(parentConfig);
  leavesHolder = (YangLeavesHolder) tmpData;
  leavesHolder.addLeaf(leaf);
  leaf.setContainedIn(leavesHolder);
  if (tmpData instanceof YangList) {
    YangList list = (YangList) tmpData;
    if (list.isConfig()) {
      for (String key : list.getKeyList()) {
        if (key.equals(leaf.getName())) {
          leaf.setKeyLeaf(true);

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

try {
  ((CollisionDetector) usesParent)
      .detectCollidingChild(leaf.getName(), LEAF_DATA);
  clonedLeaf = leaf.clone();
  clonedLeaf.setReferredLeaf(leaf);
  addUnresolvedType(this, clonedLeaf, (YangNode) usesParent);
} catch (CloneNotSupportedException | DataModelException e) {
clonedLeaf.setContainedIn(usesParent);
usesParent.addLeaf(clonedLeaf);

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

/**
 * Adds the list of leaf present under a node to resolution list, after
 * cloning. Under the cloned node, with cloned leaf, attributes are set
 * and added to resolution list.
 *
 * @param clonedNode holder node
 * @param yangUses   YANG uses
 * @throws CloneNotSupportedException clone not supported error
 * @throws DataModelException         data model error
 */
public static void cloneListOfLeaf(
    YangLeavesHolder clonedNode, YangUses yangUses)
    throws CloneNotSupportedException, DataModelException {
  List<YangLeaf> leaves = clonedNode.getListOfLeaf();
  if (nonEmpty(leaves)) {
    List<YangLeaf> clonedLeaves = new LinkedList<>();
    for (YangLeaf leaf : leaves) {
      YangLeaf clonedLeaf = leaf.clone();
      clonedLeaf.setReferredLeaf(leaf);
      addUnresolvedType(yangUses, clonedLeaf, (YangNode) clonedNode);
      clonedLeaf.setContainedIn(clonedNode);
      clonedLeaves.add(clonedLeaf);
    }
    clonedNode.setListOfLeaf(clonedLeaves);
  }
}

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

if (leaves != null && !leaves.isEmpty()) {
  for (YangLeaf leaf : leaves) {
    if (key.equals(leaf.getName())) {
      if (leaf.getDataType().getDataType() == YangDataTypes.EMPTY) {
        throw new DataModelException(" A leaf that is part of the key must not be the built-in " +
            "type \"empty\"." +
if (isConfig != keyLeaf.isConfig()) {
  throw new DataModelException("All key leafs in a list must have the same value for their" +
      " \"config\" as the list itself." +

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

/**
 * Returns the leaf which unique refers.
 *
 * @param nodeForLeaf  last node where leaf is referred
 * @param leafInUnique leaf in unique path
 * @return YANG leaf
 */
private static YangLeaf getReferenceLeafFromUnique(YangNode nodeForLeaf, YangAtomicPath leafInUnique) {
  YangLeavesHolder leavesHolder = (YangLeavesHolder) nodeForLeaf;
  List<YangLeaf> leaves = leavesHolder.getListOfLeaf();
  if (leaves != null && !leaves.isEmpty()) {
    for (YangLeaf leaf : leaves) {
      if (leafInUnique.getNodeIdentifier().getName().equals(leaf.getName())) {
        return leaf;
      }
    }
  }
  return null;
}

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

if (currentListOfLeaves != null) {
  for (YangLeaf leaf : currentListOfLeaves) {
    if (leaf.getDataType().getDataType() == YangDataTypes.ENUMERATION
        || leaf.getDataType().getDataType() == YangDataTypes.UNION) {
      try {
        YangType<?> clonedType = leaf.getDataType().clone();
        updateClonedTypeRef(clonedType, leavesHolder);
        leaf.setDataType(clonedType);
      } catch (DataModelException e) {
        throw e;
        e.printStackTrace();
        throw new DataModelException("Could not clone Type node " +
            leaf.getDataType().getDataTypeName() + " in " +
            leaf.getDataType().getLineNumber() + " at " +
            leaf.getDataType().getCharPosition() +
            " in " + leaf.getDataType().getFileName() + "\"");

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

YangType baseType = yangLeaf.getDataType();
  YangLeafRef referredLeafRefInfo = (YangLeafRef) (yangLeaf.getDataType().getDataTypeExtendedInfo());
List<YangIfFeature> referredLeafIfFeatureList = yangLeaf.getIfFeatureList();
if (referredLeafIfFeatureList != null && !referredLeafIfFeatureList.isEmpty()) {
  Iterator<YangIfFeature> referredLeafIfFeature = referredLeafIfFeatureList.iterator();

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

case LEAF_DATA:
  YangLeaf leaf = (YangLeaf) tmpData;
  leaf.setDataType(type);

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

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

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

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

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

/**
 * Returns types that has to be resolved for a single leaf/leaf-list.
 * Identifies the object to be leaf/leaf-list and assigns respective
 * parameters to resolve the types under leaf/leaf-list.
 *
 * @param clonedObj  leaf/leaf-list object
 * @param holderNode holder node
 * @param yangUses   YANG uses
 * @return list of resolvable entities in a leaf/leaf-list
 * @throws DataModelException data model error
 */
private static List<YangEntityToResolveInfoImpl> getTypesToBeResolved(
    Object clonedObj, YangNode holderNode,
    YangUses yangUses) throws DataModelException {
  YangType type;
  if (clonedObj instanceof YangLeaf) {
    YangLeaf clonedLeaf = (YangLeaf) clonedObj;
    type = clonedLeaf.getDataType();
    return getUnresolvedTypeList(type.getDataType(), type, holderNode,
                   yangUses, true);
  }
  YangLeafList clonedLeafList = (YangLeafList) clonedObj;
  type = clonedLeafList.getDataType();
  return getUnresolvedTypeList(type.getDataType(), type, holderNode,
                 yangUses, false);
}

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

case LEAF_DATA:
  enumerationNode.setName(((YangLeaf) tmpData).getName() + ENUMERATION_CLASS_SUFFIX);

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com