當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。