use of org.opendaylight.yangtools.yang.model.api.stmt.TypedefEffectiveStatement in project yangtools by opendaylight.
the class SchemaInferenceStack method pushTypedef.
@NonNull
private TypedefEffectiveStatement pushTypedef(@NonNull final EffectiveStatement<?, ?> parent, @NonNull final QName nodeIdentifier) {
final TypedefEffectiveStatement ret = parent.get(TypedefNamespace.class, nodeIdentifier).orElseThrow(() -> notPresent(parent, "Typedef", nodeIdentifier));
deque.push(ret);
return ret;
}
use of org.opendaylight.yangtools.yang.model.api.stmt.TypedefEffectiveStatement in project yangtools by opendaylight.
the class SchemaInferenceStack method pushFirstTypedef.
@NonNull
private TypedefEffectiveStatement pushFirstTypedef(@NonNull final QName nodeIdentifier) {
final ModuleEffectiveStatement module = getModule(nodeIdentifier);
final TypedefEffectiveStatement ret = pushTypedef(module, nodeIdentifier);
currentModule = module;
return ret;
}
use of org.opendaylight.yangtools.yang.model.api.stmt.TypedefEffectiveStatement in project yangtools by opendaylight.
the class YT1208Test method testTypedefStatementReuse.
@Test
public void testTypedefStatementReuse() throws Exception {
final ModuleEffectiveStatement module = StmtTestUtils.parseYangSource("/bugs/YT1208/typedef.yang").getModuleStatement(QNameModule.create(XMLNamespace.of("foo")));
final TypedefEffectiveStatement grpBar = module.findFirstEffectiveSubstatement(GroupingEffectiveStatement.class).orElseThrow().findFirstEffectiveSubstatement(ContainerEffectiveStatement.class).orElseThrow().findFirstEffectiveSubstatement(TypedefEffectiveStatement.class).orElseThrow();
final TypedefEffectiveStatement contBar = module.findFirstEffectiveSubstatement(ContainerEffectiveStatement.class).orElseThrow().findFirstEffectiveSubstatement(TypedefEffectiveStatement.class).orElseThrow();
assertSame(contBar, grpBar);
}
Aggregations