gpt4 book ai didi

org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource.forResource()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 08:54:40 35 4
gpt4 key购买 nike

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

YangTextSchemaSource.forResource介绍

[英]Create a new YangTextSchemaSource backed by a resource by a resource available on the ClassLoader which loaded the specified class.
[中]通过加载指定类的类加载器上可用的资源创建一个新的YangTextSchemaSource,该资源由一个资源支持。

代码示例

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

/**
 * Create a new {@link YangTextSchemaSource} backed by a resource available in the ClassLoader where this
 * class resides.
 *
 * @param resourceName Resource name
 * @return A new instance.
 * @throws IllegalArgumentException if the resource does not exist or if the name has invalid format
 */
// FIXME: 3.0.0: YANGTOOLS-849: return YangTextSchemaSource
public static @NonNull ResourceYangTextSchemaSource forResource(final String resourceName) {
  return forResource(YangTextSchemaSource.class, resourceName);
}

代码示例来源:origin: org.opendaylight.yangtools/yang-model-api

/**
 * Create a new {@link YangTextSchemaSource} backed by a resource available in the ClassLoader where this
 * class resides.
 *
 * @param resourceName Resource name
 * @return A new instance.
 * @throws IllegalArgumentException if the resource does not exist or if the name has invalid format
 */
// FIXME: 3.0.0: YANGTOOLS-849: return YangTextSchemaSource
public static @NonNull ResourceYangTextSchemaSource forResource(final String resourceName) {
  return forResource(YangTextSchemaSource.class, resourceName);
}

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

public static SchemaContext parseYangResources(final Class<?> clazz, final Collection<String> resources) {
  final List<YangTextSchemaSource> sources = new ArrayList<>(resources.size());
  for (final String r : resources) {
    sources.add(YangTextSchemaSource.forResource(clazz, r));
  }
  return parseSources(StatementParserMode.DEFAULT_MODE, null, sources);
}

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

/**
 * Creates a new effective schema context containing the specified YANG source.
 *
 * @param resource relative path to the YANG file to be parsed
 * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
 *                          model are resolved
 * @param parserMode mode of statement parser
 * @return effective schema context
 */
public static SchemaContext parseYangResource(final String resource, final StatementParserMode parserMode,
    final Set<QName> supportedFeatures) {
  final YangTextSchemaSource source = YangTextSchemaSource.forResource(YangParserTestUtils.class, resource);
  return parseYangSources(parserMode, supportedFeatures, source);
}

代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950

/**
 * Extracts {@link YangModelDependencyInfo} from input stream containing a YANG model. This parsing does not
 * validate full YANG module, only parses header up to the revisions and imports.
 *
 * @param refClass Base search class
 * @param resourceName resource name, relative to refClass
 * @return {@link YangModelDependencyInfo}
 * @throws YangSyntaxErrorException If the resource does not pass syntactic analysis
 * @throws IOException When the resource cannot be read
 * @throws IllegalArgumentException
 *             If input stream is not valid YANG stream
 */
@VisibleForTesting
public static YangModelDependencyInfo forResource(final Class<?> refClass, final String resourceName)
    throws IOException, YangSyntaxErrorException {
  final YangStatementStreamSource source = YangStatementStreamSource.create(
    YangTextSchemaSource.forResource(refClass, resourceName));
  final ParserRuleContext ast = source.getYangAST();
  checkArgument(ast instanceof StatementContext);
  return parseAST((StatementContext) ast, source.getIdentifier());
}

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