当前位置: 首页>>代码示例>>Java>>正文


Java StatementSource类代码示例

本文整理汇总了Java中org.opendaylight.yangtools.yang.model.api.meta.StatementSource的典型用法代码示例。如果您正苦于以下问题:Java StatementSource类的具体用法?Java StatementSource怎么用?Java StatementSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


StatementSource类属于org.opendaylight.yangtools.yang.model.api.meta包,在下文中一共展示了StatementSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testImplicitInputAndOutputInAction

import org.opendaylight.yangtools.yang.model.api.meta.StatementSource; //导入依赖的package包/类
@Test
public void testImplicitInputAndOutputInAction() throws Exception {
    final SchemaContext schemaContext = StmtTestUtils.parseYangSource("/rfc7950/bug9241/foo.yang");
    assertNotNull(schemaContext);

    final Module fooModule = schemaContext.findModule("foo", Revision.of("2017-10-13")).get();

    final ContainerSchemaNode actionCont = (ContainerSchemaNode) fooModule.getDataChildByName(QName.create(
            fooModule.getQNameModule(), "action-cont"));
    assertNotNull(actionCont);

    final ActionDefinition actionInCont = actionCont.getActions().iterator().next();

    final ContainerSchemaNode input = actionInCont.getInput();
    assertNotNull(input);
    assertEquals(1, input.getChildNodes().size());
    assertEquals(StatementSource.CONTEXT, ((EffectiveStatement<?, ?>) input).getDeclared().getStatementSource());

    final ContainerSchemaNode output = actionInCont.getOutput();
    assertNotNull(output);
    assertEquals(1, output.getChildNodes().size());
    assertEquals(StatementSource.CONTEXT, ((EffectiveStatement<?, ?>) output).getDeclared().getStatementSource());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:24,代码来源:Bug9241Test.java

示例2: testImplicitInputAndOutput

import org.opendaylight.yangtools.yang.model.api.meta.StatementSource; //导入依赖的package包/类
@Test
public void testImplicitInputAndOutput() throws Exception {
    final SchemaContext schemaContext = StmtTestUtils.parseYangSource("/rpc-stmt-test/bar.yang");
    assertNotNull(schemaContext);

    final Module barModule = schemaContext.findModule("bar", Revision.of("2016-11-25")).get();
    final Set<RpcDefinition> rpcs = barModule.getRpcs();
    assertEquals(1, rpcs.size());

    final RpcDefinition barRpc = rpcs.iterator().next();

    final ContainerSchemaNode input = barRpc.getInput();
    assertNotNull(input);
    assertEquals(2, input.getChildNodes().size());
    assertEquals(StatementSource.CONTEXT, ((EffectiveStatement<?, ?>) input).getDeclared().getStatementSource());

    final ContainerSchemaNode output = barRpc.getOutput();
    assertNotNull(output);
    assertEquals(2, output.getChildNodes().size());
    assertEquals(StatementSource.CONTEXT, ((EffectiveStatement<?, ?>) output).getDeclared().getStatementSource());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:22,代码来源:RpcStmtTest.java

示例3: maybeReplace

import org.opendaylight.yangtools.yang.model.api.meta.StatementSource; //导入依赖的package包/类
static TypeStatement maybeReplace(final TypeStatementImpl orig) {
    if (orig.declaredSubstatements().isEmpty() && orig.getStatementSource() == StatementSource.DECLARATION
            && orig.statementDefinition() == YangStmtMapping.TYPE) {
        final BuiltinTypeStatement builtin = BUILTINS.get(orig.argument());
        if (builtin != null) {
            return builtin;
        }
    }

    return orig;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:12,代码来源:BuiltinTypeStatement.java

示例4: endStatement

import org.opendaylight.yangtools.yang.model.api.meta.StatementSource; //导入依赖的package包/类
@Override
public void endStatement(@Nonnull final StatementSourceReference ref) {
    Preconditions.checkState(current != null);
    current.endDeclared(ref, phase);
    StatementContextBase<?, ?, ?> parentContext = current.getParentContext();
    while (parentContext != null && StatementSource.CONTEXT == parentContext.getStatementSource()) {
        parentContext.endDeclared(ref, phase);
        parentContext = parentContext.getParentContext();
    }
    current = parentContext;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:12,代码来源:StatementContextWriter.java

示例5: testForwarding

import org.opendaylight.yangtools.yang.model.api.meta.StatementSource; //导入依赖的package包/类
@Test
public void testForwarding() {
    final StatementSourceReference ref = mock(StatementSourceReference.class);
    final ImplicitSubstatement stmt = ImplicitSubstatement.of(ref);
    assertEquals(StatementSource.CONTEXT, stmt.getStatementSource());

    doReturn("ref").when(ref).toString();
    assertEquals("ref", stmt.toString());
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:10,代码来源:ImplicitStatementTest.java

示例6: isExplicitStatement

import org.opendaylight.yangtools.yang.model.api.meta.StatementSource; //导入依赖的package包/类
private static boolean isExplicitStatement(final ContainerSchemaNode node) {
    return (node instanceof EffectiveStatement)
            && (((EffectiveStatement) node).getDeclared().getStatementSource() == StatementSource.DECLARATION);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:5,代码来源:BindingToNormalizedNodeCodec.java

示例7: isExplicitStatement

import org.opendaylight.yangtools.yang.model.api.meta.StatementSource; //导入依赖的package包/类
private static boolean isExplicitStatement(final DeclaredStatement<?> stmt) {
    return stmt != null && stmt.getStatementSource() == StatementSource.DECLARATION;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:4,代码来源:SchemaContextEmitter.java

示例8: getStatementSource

import org.opendaylight.yangtools.yang.model.api.meta.StatementSource; //导入依赖的package包/类
@Nonnull
@Override
public final StatementSource getStatementSource() {
    return statementSource;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:6,代码来源:DeclaredEffectiveStatementBase.java

示例9: getStatementSource

import org.opendaylight.yangtools.yang.model.api.meta.StatementSource; //导入依赖的package包/类
@Nonnull
@Override
public StatementSource getStatementSource() {
    return StatementSource.CONTEXT;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:6,代码来源:TypedefEffectiveStatementImpl.java

示例10: getStatementSource

import org.opendaylight.yangtools.yang.model.api.meta.StatementSource; //导入依赖的package包/类
@Nonnull
@Override
public final StatementSource getStatementSource() {
    return getDeclared().getStatementSource();
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:6,代码来源:EmptyMandatoryEffectiveStatement.java

示例11: getStatementSource

import org.opendaylight.yangtools.yang.model.api.meta.StatementSource; //导入依赖的package包/类
@Nonnull
@Override
public final StatementSource getStatementSource() {
    return StatementSource.DECLARATION;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:6,代码来源:EmptyMandatoryStatement.java

示例12: getStatementSource

import org.opendaylight.yangtools.yang.model.api.meta.StatementSource; //导入依赖的package包/类
@Nonnull
@Override
public StatementSource getStatementSource() {
    return StatementSource.DECLARATION;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:6,代码来源:BuiltinTypeStatement.java

示例13: getStatementSource

import org.opendaylight.yangtools.yang.model.api.meta.StatementSource; //导入依赖的package包/类
/**
 * Returns the origin of the statement.
 *
 * @return origin of statement
 */
@Nonnull
@Override
public StatementSource getStatementSource() {
    return statementDeclSource.getStatementSource();
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:11,代码来源:StatementContextBase.java

示例14: createDeclaredChild

import org.opendaylight.yangtools.yang.model.api.meta.StatementSource; //导入依赖的package包/类
StatementContextBase<?, ?, ?> createDeclaredChild(final StatementContextBase<?, ?, ?> current, final int childId,
        final QName name, final String argument, final StatementSourceReference ref) {
    if (current != null) {
        // Fast path: we are entering a statement which was emitted in previous phase
        StatementContextBase<?, ?, ?> existing = current.lookupSubstatement(childId);
        while (existing != null && StatementSource.CONTEXT == existing.getStatementSource()) {
            existing = existing.lookupSubstatement(childId);
        }
        if (existing != null) {
            return existing;
        }
    }

    StatementDefinitionContext<?, ?, ?> def = currentContext.getStatementDefinition(getRootVersion(), name);
    if (def == null) {
        def = currentContext.getModelDefinedStatementDefinition(name);
        if (def == null) {
            final StatementSupport<?, ?, ?> extension = qnameToStmtDefMap.get(name);
            if (extension != null) {
                def = new StatementDefinitionContext<>(extension);
                currentContext.putModelDefinedStatementDefinition(name, def);
            }
        }
    } else if (current != null && StmtContextUtils.isUnrecognizedStatement(current)) {
        /*
         * This code wraps statements encountered inside an extension so
         * they do not get confused with regular statements.
         */
        def = Preconditions.checkNotNull(current.definition().getAsUnknownStatementDefinition(def),
                "Unable to create unknown statement definition of yang statement %s in unknown statement %s", def,
                current);
    }

    InferenceException.throwIfNull(def, ref, "Statement %s does not have type mapping defined.", name);
    if (def.hasArgument()) {
        SourceException.throwIfNull(argument, ref, "Statement %s requires an argument", name);
    } else {
        SourceException.throwIf(argument != null, ref, "Statement %s does not take argument", name);
    }

    /*
     * If the current statement definition has argument specific
     * sub-definitions, get argument specific sub-definition based on given
     * argument (e.g. type statement need to be specialized based on its
     * argument).
     */
    if (def.hasArgumentSpecificSubDefinitions()) {
        def = def.getSubDefinitionSpecificForArgument(argument);
    }

    if (current != null) {
        return current.createSubstatement(childId, def, ref, argument);
    }

    /*
     * If root is null or root version is other than default,
     * we need to create new root.
     */
    if (root == null) {
        root = new RootStatementContext<>(this, def, ref, argument);
    } else if (!RootStatementContext.DEFAULT_VERSION.equals(root.getRootVersion())
            && inProgressPhase == ModelProcessingPhase.SOURCE_LINKAGE) {
        root = new RootStatementContext<>(this, def, ref, argument, root.getRootVersion(),
                root.getRootIdentifier());
    } else {
        final QName rootStatement = root.definition().getStatementName();
        final String rootArgument = root.rawStatementArgument();

        Preconditions.checkState(Objects.equals(def.getStatementName(), rootStatement)
            && Objects.equals(argument, rootArgument), "Root statement was already defined as '%s %s'.",
            rootStatement, rootArgument);
    }
    return root;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:75,代码来源:SourceSpecificContext.java

示例15: getStatementSource

import org.opendaylight.yangtools.yang.model.api.meta.StatementSource; //导入依赖的package包/类
@Nonnull
@Override
public StatementSource getStatementSource() {
    return source;
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:6,代码来源:AbstractDeclaredStatement.java


注:本文中的org.opendaylight.yangtools.yang.model.api.meta.StatementSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。