本文整理了Java中org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory.createParser()
方法的一些代码示例,展示了YangParserFactory.createParser()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangParserFactory.createParser()
方法的具体详情如下:
包路径:org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory
类名称:YangParserFactory
方法名:createParser
[英]Create a YangParser instance operating in default import resolution mode.
[中]创建一个在默认导入解析模式下运行的语法分析器实例。
代码示例来源:origin: opendaylight/yangtools
/**
* Create a {@link YangParser} instance operating in default import resolution mode.
*
* @return A new {@link YangParser} instance
*/
default YangParser createParser() {
return createParser(StatementParserMode.DEFAULT_MODE);
}
代码示例来源: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
final YangParser parser = parserFactory.createParser(parserMode);
final List<YangTextSchemaSource> sourcesInProject = new ArrayList<>(yangFilesInProject.size());
for (final File f : yangFilesInProject) {
代码示例来源: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();
}
内容来源于网络,如有侵权,请联系作者删除!