gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-19 12:57:31 27 4
gpt4 key购买 nike

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

YangList介绍

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

代码示例

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

/**
 * Validates the data on exiting the corresponding parse tree node.
 *
 * @throws DataModelException a violation of data model rules
 */
@Override
public void validateDataOnExit()
    throws DataModelException {
  List<String> keys = getKeyList();
  List<YangLeaf> leaves = getListOfLeaf();
  List<YangLeafList> leafLists = getListOfLeafList();
  validateConfig(leaves, leafLists);
  //A list must have atleast one key leaf if config is true
  if (isConfig && (keys.isEmpty() || leaves.isEmpty()) && !isUsesPresentInList()
      && !isListPresentInGrouping()) {
    throw new DataModelException("A list must have atleast one key leaf if config is true; " +
        getName() + " in " +
        getLineNumber() + " at " +
        getCharPosition() +
        " in " + getFileName() + "\"");
  } else if (keys != null) {
    validateKey(leaves, keys);
  }
}

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

/**
 * Adds a unique field name.
 *
 * @param unique unique field name.
 * @throws DataModelException a violation of data model rules
 */
public void addUnique(String unique)
    throws DataModelException {
  if (getUniqueList() == null) {
    setUniqueList(new LinkedList<>());
  }
  if (getUniqueList().contains(unique)) {
    throw new DataModelException("A leaf identifier must not appear more than once in the\n" +
        "   unique" +
        getName() + " in " +
        getLineNumber() + " at " +
        getCharPosition() +
        " in " + getFileName() + "\"");
  }
  getUniqueList().add(unique);
}

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

private boolean isUsesPresentInList() {
  YangNode node = getChild();
  while (node != null) {
    if (node instanceof YangUses) {
      return true;
    }
    node = node.getNextSibling();
  }
  return false;
  // TODO When grouping linking is done this method has to be modified.
}

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

@Override
public void detectSelfCollision(String identifierName, YangConstructType dataType)
    throws DataModelException {
  if (getName().equals(identifierName)) {
    throw new DataModelException("YANG file error: Duplicate input identifier detected, same as list \"" +
        getName() + " in " +
        getLineNumber() + " at " +
        getCharPosition() +
        " in " + getFileName() + "\"");
  }
}

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

@Override
  public void setLeafNameSpaceAndAddToParentSchemaMap() {
    // Add namespace for all leafs.
    for (YangLeaf yangLeaf : getListOfLeaf()) {
      yangLeaf.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
    }
    // Add namespace for all leaf list.
    for (YangLeafList yangLeafList : getListOfLeafList()) {
      yangLeafList.setLeafNameSpaceAndAddToParentSchemaMap(getNameSpace());
    }
  }
}

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

/**
 * Adds a key field name.
 *
 * @param key key field name.
 * @throws DataModelException a violation of data model rules
 */
public void addKey(String key)
    throws DataModelException {
  if (getKeyList() == null) {
    setKeyList(new LinkedList<>());
  }
  if (getKeyList().contains(key)) {
    throw new DataModelException("A leaf identifier must not appear more than once in the\n" +
        "   key" +
        getName() + " in " +
        getLineNumber() + " at " +
        getCharPosition() +
        " in " + getFileName() + "\"");
  }
  getKeyList().add(key);
}

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

throw new DataModelException(" A leaf that is part of the key must not be the built-in " +
            "type \"empty\"." +
            getName() + " in " +
            getLineNumber() + " at " +
            getCharPosition() +
            " in " + getFileName() + "\"");
if (!leafFound && !isUsesPresentInList() && !isListPresentInGrouping()) {
  throw new DataModelException("An identifier, in key, must refer to a child leaf of the list" +
      getName() + " in " +
      getLineNumber() + " at " +
      getCharPosition() +
      " in " + getFileName() + "\"");
  throw new DataModelException("All key leafs in a list must have the same value for their" +
      " \"config\" as the list itself." +
      getName() + " in " +
      getLineNumber() + " at " +
      getCharPosition() +
      " in " + getFileName() + "\"");

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

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-utils-parser

List<String> uniques = yangList.getUniqueList();
if (uniques != null && !uniques.isEmpty()) {
  Iterator<String> uniqueList = uniques.listIterator();

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

/**
 * Adds a leaf.
 *
 * @param leaf the leaf to be added
 */
@Override
public void addLeaf(YangLeaf leaf) {
  getListOfLeaf().add(leaf);
}

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

for (String uniqueValue : uniqueValues) {
  try {
    yangList.addUnique(uniqueValue);
  } catch (DataModelException e) {
    throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA,
  yangList.addUnique(tmpUniqueValue);
} catch (DataModelException e) {
  throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA, UNIQUE_DATA,

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

for (String keyValue : keyValues) {
  try {
    yangList.addKey(keyValue);
  } catch (DataModelException e) {
    throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA, KEY_DATA,
  yangList.addKey(tmpKeyValue);
} catch (DataModelException e) {
  throw new ParserException(constructExtendedListenerErrorMessage(UNHANDLED_PARSED_DATA, KEY_DATA,

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

throw new DataModelException("If a list has \"config\" set to \"false\", no node underneath " +
      "it can have \"config\" set to \"true\"." +
      getName() + " in " +
      getLineNumber() + " at " +
      getCharPosition() +
      " in " + getFileName() + "\"");
if (leafList.isConfig()) {
  throw new DataModelException("If a list has \"config\" set to \"false\", no node underneath " +
      "it can have \"config\" set to \"true\"." + getName() + " in " +
      getLineNumber() + " at " +
      getCharPosition() +
      " in " + getFileName() + "\"");

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