gpt4 book ai didi

org.opendaylight.yangtools.yang.model.parser.api.YangParser.setSupportedFeatures()方法的使用及代码示例

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

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

YangParser.setSupportedFeatures介绍

[英]Set supported features based on which all if-feature statements in the parsed YANG modules will be resolved. If this method is not invoked, all features will be supported.
[中]设置支持的功能,解析模块中的所有if功能语句都将基于这些功能进行解析。如果不调用此方法,则将支持所有功能。

代码示例

代码示例来源:origin: opendaylight/yangtools

public static SchemaContext parseSources(final StatementParserMode parserMode, final Set<QName> supportedFeatures,
    final Collection<? extends SchemaSourceRepresentation> sources) {
  final YangParser parser = PARSER_FACTORY.createParser(parserMode);
  if (supportedFeatures != null) {
    parser.setSupportedFeatures(supportedFeatures);
  }
  try {
    parser.addSources(sources);
  } catch (YangSyntaxErrorException e) {
    throw new IllegalArgumentException("Malformed source", e);
  } catch (IOException e) {
    throw new IllegalArgumentException("Failed to read a source", e);
  }
  try {
    return parser.buildSchemaContext();
  } catch (YangParserException e) {
    throw new IllegalStateException("Failed to assemble SchemaContext", e);
  }
}

代码示例来源:origin: opendaylight/yangtools

static SchemaContext parseYangSources(final Set<QName> supportedFeatures, final List<File> testFiles,
    final List<File> libFiles) throws IOException, YangParserException {
  checkArgument(!testFiles.isEmpty(), "No yang sources");
  final YangParser parser = PARSER_FACTORY.createParser();
  if (supportedFeatures != null) {
    parser.setSupportedFeatures(supportedFeatures);
  }
  for (File file : testFiles) {
    parser.addSource(YangTextSchemaSource.forFile(file));
  }
  for (File file : libFiles) {
    parser.addLibSource(YangTextSchemaSource.forFile(file));
  }
  return parser.buildSchemaContext();
}

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