gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-16 18:41:31 26 4
gpt4 key购买 nike

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

YangLeafList介绍

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

代码示例

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

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

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

YangLeafList clonedLeafList;
if (!isDeviation) {
  clonedLeafList = leafList.clone();
  addUnresolvedType(yangUses, clonedLeafList,
           (YangNode) clonedNode);
} else {
  clonedLeafList = leafList.cloneForDeviation();
clonedLeafList.setReferredSchemaLeafList(leafList);
clonedLeafList.setContainedIn(clonedNode);
clonedList.add(clonedLeafList);

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

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

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

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

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

try {
  ((CollisionDetector) destLeafHolder)
      .detectCollidingChild(leafList.getName(), LEAF_LIST_DATA);
  clonedLeafList = leafList.cloneForDeviation();
  clonedLeafList.setReferredSchemaLeafList(leafList);
} catch (CloneNotSupportedException | DataModelException e) {
  throw new DataModelException(e.getMessage());
clonedLeafList.setContainedIn(destLeafHolder);
destLeafHolder.addLeafList(clonedLeafList);

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

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

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

try {
  ((CollisionDetector) usesParent)
      .detectCollidingChild(leafList.getName(), LEAF_LIST_DATA);
  clonedLeafList = leafList.clone();
  clonedLeafList.setReferredSchemaLeafList(leafList);
  addUnresolvedType(this, clonedLeafList,
           (YangNode) usesParent);
  throw new DataModelException(e.getMessage());
clonedLeafList.setContainedIn(usesParent);
usesParent.addLeafList(clonedLeafList);

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

leafList.setName(identifier);
leafList.setLineNumber(line);
leafList.setCharPosition(charPositionInLine);
leafList.setFileName(listener.getFileName());
  leafList.setConfig(parentConfig);
  leavesHolder = (YangLeavesHolder) tmpData;
  leavesHolder.addLeafList(leafList);
  leafList.setContainedIn(leavesHolder);
} else {
  throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, LEAF_LIST_DATA,

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

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

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

ll.setContainedIn(logical);
if (logLl == null) {
  logLl = new LinkedList<>();

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

} else if (getReferredLeafOrLeafList() instanceof YangLeafList) {
  YangLeafList yangLeafList = ((YangLeafList) getReferredLeafOrLeafList());
  YangType baseType = yangLeafList.getDataType();
    YangLeafRef referredLeafRefInfo = (YangLeafRef) yangLeafList.getDataType().getDataTypeExtendedInfo();
  List<YangIfFeature> referredLeafListIfFeatureList = yangLeafList.getIfFeatureList();
  if (referredLeafListIfFeatureList != null && !referredLeafListIfFeatureList.isEmpty()) {
    Iterator<YangIfFeature> referredLeafListIfFeature = referredLeafListIfFeatureList.iterator();

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

((YangLeafList) targetNode).setDataType(deviateReplace
                        .getDataType());

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

case LEAF_LIST_DATA:
  YangLeafList leafList = (YangLeafList) tmpData;
  leafList.setDataType(type);

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

/**
 * Adds the unresolved constructs to stack which has to be resolved for leafref.
 *
 * @param leavesInfo      YANG leaf or leaf list which holds the type
 * @param ancestorRefNode holder of the YANG leaf or leaf list
 */
private void addUnResolvedLeafRefTypeToStack(T leavesInfo, YangNode ancestorRefNode) {
  YangType refType;
  T extendedInfo;
  if (leavesInfo instanceof YangLeaf) {
    YangLeaf leaf = (YangLeaf) leavesInfo;
    refType = leaf.getDataType();
  } else {
    YangLeafList leafList = (YangLeafList) leavesInfo;
    refType = leafList.getDataType();
  }
  extendedInfo = (T) refType.getDataTypeExtendedInfo();
  addUnResolvedTypeDataToStack(refType, ancestorRefNode, extendedInfo);
}

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

/**
 * Detects the colliding identifier name in a given leaf-list node.
 *
 * @param listOfLeafList list of leaf-lists 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 detectCollidingLeafList(List<YangLeafList> listOfLeafList, String identifierName)
    throws DataModelException {
  if (listOfLeafList == null) {
    return;
  }
  for (YangLeafList leafList : listOfLeafList) {
    if (leafList.getName().equals(identifierName)) {
      throw new DataModelException("YANG file error: Duplicate input identifier detected, same as leaf " +
                         "list \"" + leafList.getName() + " in " +
                         leafList.getLineNumber() + " at " +
                         leafList.getCharPosition() +
                         " in " + leafList.getFileName() + "\"");
    }
  }
}

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

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