Search in sources :

Example 1 with TypedefEffectiveStatement

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;
}
Also used : TypedefNamespace(org.opendaylight.yangtools.yang.model.api.stmt.TypedefNamespace) TypedefEffectiveStatement(org.opendaylight.yangtools.yang.model.api.stmt.TypedefEffectiveStatement) NonNull(org.eclipse.jdt.annotation.NonNull) Objects.requireNonNull(java.util.Objects.requireNonNull)

Example 2 with TypedefEffectiveStatement

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;
}
Also used : TypedefEffectiveStatement(org.opendaylight.yangtools.yang.model.api.stmt.TypedefEffectiveStatement) ModuleEffectiveStatement(org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement) NonNull(org.eclipse.jdt.annotation.NonNull) Objects.requireNonNull(java.util.Objects.requireNonNull)

Example 3 with TypedefEffectiveStatement

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);
}
Also used : ContainerEffectiveStatement(org.opendaylight.yangtools.yang.model.api.stmt.ContainerEffectiveStatement) TypedefEffectiveStatement(org.opendaylight.yangtools.yang.model.api.stmt.TypedefEffectiveStatement) GroupingEffectiveStatement(org.opendaylight.yangtools.yang.model.api.stmt.GroupingEffectiveStatement) ModuleEffectiveStatement(org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement) Test(org.junit.Test)

Aggregations

TypedefEffectiveStatement (org.opendaylight.yangtools.yang.model.api.stmt.TypedefEffectiveStatement)3 Objects.requireNonNull (java.util.Objects.requireNonNull)2 NonNull (org.eclipse.jdt.annotation.NonNull)2 ModuleEffectiveStatement (org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement)2 Test (org.junit.Test)1 ContainerEffectiveStatement (org.opendaylight.yangtools.yang.model.api.stmt.ContainerEffectiveStatement)1 GroupingEffectiveStatement (org.opendaylight.yangtools.yang.model.api.stmt.GroupingEffectiveStatement)1 TypedefNamespace (org.opendaylight.yangtools.yang.model.api.stmt.TypedefNamespace)1