...
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
static YangParserFactory PARSER_FACTORY; static { final Iterator<YangParserFactory> it = ServiceLoader.load(YangParserFactory.class).iterator(); if (!it.hasNext()) { throw new IllegalStateException("No YangParserFactory found"); } PARSER_FACTORY = it.next(); } ... File file = new File(ClassLoader.getSystemClassLoader(classLoader).getResource(fileName"example.yang").getFile()); YangTextSchemaSource source = YangTextSchemaSource.forFile(file); final YangParser yangParser = PARSER_FACTORY.createParser(StatementParserMode.DEFAULT_MODE); yangParser.addSource(source); SchemaContext schemaContext = yangParser.buildEffectiveModel(); schemaContext.getModules() |
...