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

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

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

YangList.getKeyList介绍

[英]Returns the set of key field names.
[中]返回一组键字段名。

代码示例

代码示例来源:origin: org.onosproject/onos-yang-compiler-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 LinkedHashSet<String>());
  }
  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-compiler-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 {
  LinkedHashSet<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-compiler-parser

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

相关文章

YangList类方法