Eliminate a verifyication by cleanly translating Module to
ModuleEffectiveStatement.
Change-Id: I65a08a388e54132457ac8d99d981cbd332d0c009
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.PathExpression;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.PathExpression;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement;
// AugmentGenerators without having forward references.
// FIXME: migrate to new ModuleDependencySort when it is available, which streamline things here
children = ModuleDependencySort.sort(context.getModules()).stream()
// AugmentGenerators without having forward references.
// FIXME: migrate to new ModuleDependencySort when it is available, which streamline things here
children = ModuleDependencySort.sort(context.getModules()).stream()
- .map(module -> {
- verify(module instanceof ModuleEffectiveStatement, "Unexpected module %s", module);
- return new ModuleGenerator((ModuleEffectiveStatement) module);
- })
+ .map(Module::asEffectiveStatement)
+ .map(ModuleGenerator::new)
.collect(Collectors.toUnmodifiableList());
generators = Maps.uniqueIndex(children, gen -> gen.statement().localQNameModule());
}
.collect(Collectors.toUnmodifiableList());
generators = Maps.uniqueIndex(children, gen -> gen.statement().localQNameModule());
}