import com.google.common.annotations.Beta;
import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
@Beta
public interface ActionEffectiveStatement extends SchemaTreeEffectiveStatement<ActionStatement>,
- DataTreeAwareEffectiveStatement<QName, ActionStatement> {
-
+ DataTreeAwareEffectiveStatement<QName, ActionStatement> {
+ @Override
+ default StatementDefinition statementDefinition() {
+ return YangStmtMapping.ACTION;
+ }
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.yangtools.yang.model.api.stmt;
import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
/**
* Represents YANG action statement.
*/
@Beta
public interface ActionStatement extends OperationDeclaredStatement {
-
+ @Override
+ default StatementDefinition statementDefinition() {
+ return YangStmtMapping.ACTION;
+ }
}
import com.google.common.annotations.Beta;
import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
@Beta
-public interface RpcEffectiveStatement extends SchemaTreeEffectiveStatement<RpcStatement>,
- DataTreeAwareEffectiveStatement<QName, RpcStatement> {
-
+public interface RpcEffectiveStatement
+ extends SchemaTreeEffectiveStatement<RpcStatement>, DataTreeAwareEffectiveStatement<QName, RpcStatement> {
+ @Override
+ default StatementDefinition statementDefinition() {
+ return YangStmtMapping.RPC;
+ }
}
*/
package org.opendaylight.yangtools.yang.model.api.stmt;
-public interface RpcStatement extends OperationDeclaredStatement {
+import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+public interface RpcStatement extends OperationDeclaredStatement {
+ @Override
+ default StatementDefinition statementDefinition() {
+ return YangStmtMapping.RPC;
+ }
}
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt;
-import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects;
import com.google.common.base.Verify;
import com.google.common.collect.ImmutableSet;
import org.opendaylight.yangtools.yang.model.api.stmt.TypedefEffectiveStatement;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
-@Beta
+@Deprecated(forRemoval = true)
public abstract class AbstractEffectiveOperationDefinition<D extends DeclaredStatement<QName>>
extends AbstractEffectiveSchemaNode<D> implements OperationDefinition {
private final ImmutableSet<TypeDefinition<?>> typeDefinitions;
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt;
+import static com.google.common.base.Verify.verify;
+
import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects;
import com.google.common.collect.Collections2;
import org.opendaylight.yangtools.yang.model.api.MustDefinition;
import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
import org.opendaylight.yangtools.yang.model.api.NotificationNodeContainer;
+import org.opendaylight.yangtools.yang.model.api.OperationDefinition;
import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
import org.opendaylight.yangtools.yang.model.api.SchemaNode;
import org.opendaylight.yangtools.yang.model.api.Status;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.InputEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.OutputEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.TypedefEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.WhenEffectiveStatement;
public interface DataNodeContainerMixin<A, D extends DeclaredStatement<A>> extends DataNodeContainer, Mixin<A, D> {
@Override
default Set<TypeDefinition<?>> getTypeDefinitions() {
- // TODO: the cast here is needed to work around Java 11 javac type inference issue
- return (Set) effectiveSubstatements().stream().filter(TypedefEffectiveStatement.class::isInstance)
- .map(stmt -> ((TypedefEffectiveStatement) stmt).getTypeDefinition())
- .collect(ImmutableSet.toImmutableSet());
+ return filterTypeDefinitions(this);
}
@Override
}
/**
- * Helper bridge for {@code anydata} and {@code anyxml} opaque data..
+ * Helper bridge for {@code anydata} and {@code anyxml} opaque data.
*
* @param <D> Class representing declared version of this statement.
*/
}
}
+ /**
+ * Helper bridge for {@code rpc} and {@code action} operations.
+ *
+ * @param <D> Class representing declared version of this statement.
+ */
+ public interface OperationDefinitionMixin<D extends DeclaredStatement<QName>>
+ extends SchemaNodeMixin<QName, D>, OperationDefinition {
+ @Override
+ default @NonNull QName argument() {
+ return getPath().getLastComponent();
+ }
+
+ @Override
+ default QName getQName() {
+ return argument();
+ }
+
+ @Override
+ default Set<TypeDefinition<?>> getTypeDefinitions() {
+ return filterTypeDefinitions(this);
+ }
+
+ @Override
+ default Set<GroupingDefinition> getGroupings() {
+ return filterEffectiveStatementsSet(GroupingDefinition.class);
+ }
+
+ @Override
+ default ContainerSchemaNode getInput() {
+ return findAsContainer(this, InputEffectiveStatement.class);
+ }
+
+ @Override
+ default ContainerSchemaNode getOutput() {
+ return findAsContainer(this, OutputEffectiveStatement.class);
+ }
+ }
+
/**
* Support interface for various mixins. Implementations are required to store 32bits worth of flags, which are
* globally assigned to sub-interfaces -- thus providing storage for many low-cardinality properties.
}
}
}
+
+ private EffectiveStatementMixins() {
+ }
+
+ static ContainerSchemaNode findAsContainer(final EffectiveStatement<?, ?> stmt,
+ final Class<? extends EffectiveStatement<QName, ?>> type) {
+ final EffectiveStatement<?, ?> statement = stmt.findFirstEffectiveSubstatement(type).get();
+ verify(statement instanceof ContainerSchemaNode, "Child statement %s is not a ContainerSchemaNode",
+ statement);
+ return (ContainerSchemaNode) statement;
+ }
+
+ static Set<TypeDefinition<?>> filterTypeDefinitions(final Mixin<?, ?> stmt) {
+ // TODO: the cast here is needed to work around Java 11 javac type inference issue
+ return (Set) stmt.effectiveSubstatements().stream()
+ .filter(TypedefEffectiveStatement.class::isInstance)
+ .map(typedef -> ((TypedefEffectiveStatement) typedef).getTypeDefinition())
+ .collect(ImmutableSet.toImmutableSet());
+ }
}
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.action;
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.collect.ImmutableList;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.ActionDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ActionEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ActionStatement;
-import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractEffectiveOperationDefinition;
-import org.opendaylight.yangtools.yang.parser.spi.meta.CopyHistory;
-import org.opendaylight.yangtools.yang.parser.spi.meta.CopyType;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredEffectiveStatement.DefaultWithDataTree.WithSubstatements;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.EffectiveStatementMixins.CopyableMixin;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.EffectiveStatementMixins.OperationDefinitionMixin;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
-final class ActionEffectiveStatementImpl extends AbstractEffectiveOperationDefinition<ActionStatement>
- implements ActionDefinition, ActionEffectiveStatement {
- private final boolean augmenting;
- private final boolean addedByUses;
-
- ActionEffectiveStatementImpl(final StmtContext<QName, ActionStatement, ActionEffectiveStatement> ctx) {
- super(ctx);
+final class ActionEffectiveStatementImpl extends WithSubstatements<QName, ActionStatement, ActionEffectiveStatement>
+ implements ActionDefinition, ActionEffectiveStatement, OperationDefinitionMixin<ActionStatement>,
+ CopyableMixin<QName, ActionStatement> {
+ private final @NonNull SchemaPath path;
+ private final int flags;
- // initCopyType
- final CopyHistory copyTypesFromOriginal = ctx.getCopyHistory();
- if (copyTypesFromOriginal.contains(CopyType.ADDED_BY_USES_AUGMENTATION)) {
- this.augmenting = true;
- this.addedByUses = true;
- } else {
- this.augmenting = copyTypesFromOriginal.contains(CopyType.ADDED_BY_AUGMENTATION);
- this.addedByUses = copyTypesFromOriginal.contains(CopyType.ADDED_BY_USES);
- }
+ ActionEffectiveStatementImpl(final ActionStatement declared, final SchemaPath path, final int flags,
+ final StmtContext<QName, ActionStatement, ActionEffectiveStatement> ctx,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(declared, ctx, substatements);
+ this.path = requireNonNull(path);
+ this.flags = flags;
}
- @Deprecated
@Override
- public boolean isAugmenting() {
- return augmenting;
+ public @NonNull SchemaPath getPath() {
+ return path;
}
- @Deprecated
@Override
- public boolean isAddedByUses() {
- return addedByUses;
+ public int flags() {
+ return flags;
}
}
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.action;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.Status;
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
import org.opendaylight.yangtools.yang.model.api.stmt.ActionEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ActionStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.InputStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.OutputStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.StatusEffectiveStatement;
import org.opendaylight.yangtools.yang.parser.rfc7950.namespace.ChildSchemaNodeNamespace;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseQNameStatementSupport;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.EffectiveStatementMixins.EffectiveStatementWithFlags.FlagsBuilder;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.input.InputStatementRFC7950Support;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.output.OutputStatementRFC7950Support;
-import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractQNameStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
-public final class ActionStatementSupport
- extends AbstractQNameStatementSupport<ActionStatement, ActionEffectiveStatement> {
+public final class ActionStatementSupport extends BaseQNameStatementSupport<ActionStatement, ActionEffectiveStatement> {
private static final ImmutableSet<StatementDefinition> ILLEGAL_PARENTS = ImmutableSet.of(
YangStmtMapping.NOTIFICATION, YangStmtMapping.RPC, YangStmtMapping.ACTION);
stmt.coerceParentContext().addToNs(ChildSchemaNodeNamespace.class, stmt.coerceStatementArgument(), stmt);
}
- @Override
- public ActionStatement createDeclared(
- final StmtContext<QName, ActionStatement, ?> ctx) {
- return new ActionStatementImpl(ctx);
- }
-
- @Override
- public ActionEffectiveStatement createEffective(
- final StmtContext<QName, ActionStatement, ActionEffectiveStatement> ctx) {
- SourceException.throwIf(StmtContextUtils.hasAncestorOfType(ctx, ILLEGAL_PARENTS),
- ctx.getStatementSourceReference(),
- "Action %s is defined within a notification, rpc or another action", ctx.getStatementArgument());
- SourceException.throwIf(!StmtContextUtils.hasAncestorOfTypeWithChildOfType(ctx, YangStmtMapping.LIST,
- YangStmtMapping.KEY), ctx.getStatementSourceReference(),
- "Action %s is defined within a list that has no key statement", ctx.getStatementArgument());
- SourceException.throwIf(StmtContextUtils.hasParentOfType(ctx, YangStmtMapping.CASE),
- ctx.getStatementSourceReference(), "Action %s is defined within a case statement",
- ctx.getStatementArgument());
- SourceException.throwIf(StmtContextUtils.hasParentOfType(ctx, YangStmtMapping.MODULE),
- ctx.getStatementSourceReference(), "Action %s is defined at the top level of a module",
- ctx.getStatementArgument());
- return new ActionEffectiveStatementImpl(ctx);
- }
-
@Override
public void onFullDefinitionDeclared(final Mutable<QName, ActionStatement, ActionEffectiveStatement> stmt) {
super.onFullDefinitionDeclared(stmt);
protected SubstatementValidator getSubstatementValidator() {
return SUBSTATEMENT_VALIDATOR;
}
+
+ @Override
+ protected ActionStatement createDeclared(final StmtContext<QName, ActionStatement, ?> ctx,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ return new RegularActionStatement(ctx.coerceStatementArgument(), substatements);
+ }
+
+ @Override
+ protected ActionStatement createEmptyDeclared(final StmtContext<QName, ActionStatement, ?> ctx) {
+ return new EmptyActionStatement(ctx.coerceStatementArgument());
+ }
+
+ @Override
+ protected ActionEffectiveStatement createEffective(
+ final StmtContext<QName, ActionStatement, ActionEffectiveStatement> ctx, final ActionStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ final QName argument = ctx.coerceStatementArgument();
+ final StatementSourceReference ref = ctx.getStatementSourceReference();
+ SourceException.throwIf(StmtContextUtils.hasAncestorOfType(ctx, ILLEGAL_PARENTS), ref,
+ "Action %s is defined within a notification, rpc or another action", argument);
+ SourceException.throwIf(
+ !StmtContextUtils.hasAncestorOfTypeWithChildOfType(ctx, YangStmtMapping.LIST, YangStmtMapping.KEY), ref,
+ "Action %s is defined within a list that has no key statement", argument);
+ SourceException.throwIf(StmtContextUtils.hasParentOfType(ctx, YangStmtMapping.CASE), ref,
+ "Action %s is defined within a case statement", argument);
+ SourceException.throwIf(StmtContextUtils.hasParentOfType(ctx, YangStmtMapping.MODULE), ref,
+ "Action %s is defined at the top level of a module", argument);
+
+ return new ActionEffectiveStatementImpl(declared, ctx.getSchemaPath().get(), computeFlags(ctx, substatements),
+ ctx, substatements);
+ }
+
+ @Override
+ protected ActionEffectiveStatement createEmptyEffective(
+ final StmtContext<QName, ActionStatement, ActionEffectiveStatement> ctx, final ActionStatement declared) {
+ throw new IllegalStateException("Missing implicit input/output statements at "
+ + ctx.getStatementSourceReference());
+ }
+
+ private static int computeFlags(final StmtContext<?, ?, ?> ctx,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new FlagsBuilder()
+ .setHistory(ctx.getCopyHistory())
+ .setStatus(findFirstArgument(substatements, StatusEffectiveStatement.class, Status.CURRENT))
+ .toFlags();
+ }
+
}
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.stmt.ActionStatement;
-import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithQNameArgument;
-final class ActionStatementImpl extends AbstractDeclaredStatement<QName> implements ActionStatement {
- ActionStatementImpl(final StmtContext<QName, ActionStatement, ?> context) {
- super(context);
+final class EmptyActionStatement extends WithQNameArgument implements ActionStatement {
+ EmptyActionStatement(final QName argument) {
+ super(argument);
}
}
--- /dev/null
+/*
+ * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.action;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ActionStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithQNameArgument.WithSubstatements;
+
+final class RegularActionStatement extends WithSubstatements implements ActionStatement {
+ RegularActionStatement(final QName argument, final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ super(argument, substatements);
+ }
+}
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.rpc;
+import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.Status;
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.InputStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.OutputStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.RpcEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.RpcStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.StatusEffectiveStatement;
import org.opendaylight.yangtools.yang.parser.rfc7950.namespace.ChildSchemaNodeNamespace;
-import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractQNameStatementSupport;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseQNameStatementSupport;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.EffectiveStatementMixins.EffectiveStatementWithFlags.FlagsBuilder;
import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
-abstract class AbstractRpcStatementSupport
- extends AbstractQNameStatementSupport<RpcStatement, RpcEffectiveStatement> {
+abstract class AbstractRpcStatementSupport extends BaseQNameStatementSupport<RpcStatement, RpcEffectiveStatement> {
private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(
YangStmtMapping.RPC)
.addOptional(YangStmtMapping.DESCRIPTION)
stmt.coerceParentContext().addToNs(ChildSchemaNodeNamespace.class, stmt.coerceStatementArgument(), stmt);
}
- @Override
- public final RpcStatement createDeclared(final StmtContext<QName, RpcStatement, ?> ctx) {
- return new RpcStatementImpl(ctx);
- }
-
- @Override
- public final RpcEffectiveStatement createEffective(
- final StmtContext<QName, RpcStatement, RpcEffectiveStatement> ctx) {
- return new RpcEffectiveStatementImpl(ctx);
- }
-
@Override
public final void onFullDefinitionDeclared(final Mutable<QName, RpcStatement, RpcEffectiveStatement> stmt) {
super.onFullDefinitionDeclared(stmt);
}
}
-
@Override
protected final SubstatementValidator getSubstatementValidator() {
return SUBSTATEMENT_VALIDATOR;
}
+ @Override
+ protected final RpcStatement createDeclared(final StmtContext<QName, RpcStatement, ?> ctx,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ return new RegularRpcStatement(ctx.coerceStatementArgument(), substatements);
+ }
+
+ @Override
+ protected final RpcStatement createEmptyDeclared(final StmtContext<QName, RpcStatement, ?> ctx) {
+ return new EmptyRpcStatement(ctx.coerceStatementArgument());
+ }
+
+ @Override
+ protected final RpcEffectiveStatement createEffective(
+ final StmtContext<QName, RpcStatement, RpcEffectiveStatement> ctx, final RpcStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new RpcEffectiveStatementImpl(declared, ctx.getSchemaPath().get(), computeFlags(ctx, substatements), ctx,
+ substatements);
+ }
+
+ @Override
+ protected final RpcEffectiveStatement createEmptyEffective(
+ final StmtContext<QName, RpcStatement, RpcEffectiveStatement> ctx, final RpcStatement declared) {
+ throw new IllegalStateException("Missing implicit input/output statements at "
+ + ctx.getStatementSourceReference());
+ }
+
abstract StatementSupport<?, ?, ?> implictInput();
abstract StatementSupport<?, ?, ?> implictOutput();
+
+ private static int computeFlags(final StmtContext<?, ?, ?> ctx,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new FlagsBuilder()
+ .setStatus(findFirstArgument(substatements, StatusEffectiveStatement.class, Status.CURRENT))
+ .toFlags();
+ }
}
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.stmt.RpcStatement;
-import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithQNameArgument;
-final class RpcStatementImpl extends AbstractDeclaredStatement<QName> implements RpcStatement {
- RpcStatementImpl(final StmtContext<QName, RpcStatement, ?> context) {
- super(context);
+final class EmptyRpcStatement extends WithQNameArgument implements RpcStatement {
+ EmptyRpcStatement(final QName argument) {
+ super(argument);
}
}
--- /dev/null
+/*
+ * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.rpc;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.RpcStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithQNameArgument.WithSubstatements;
+
+final class RegularRpcStatement extends WithSubstatements implements RpcStatement {
+ RegularRpcStatement(final QName argument, final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ super(argument, substatements);
+ }
+}
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.rpc;
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.collect.ImmutableList;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.RpcEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.RpcStatement;
-import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractEffectiveOperationDefinition;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredEffectiveStatement.DefaultWithDataTree.WithSubstatements;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.EffectiveStatementMixins.OperationDefinitionMixin;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
-final class RpcEffectiveStatementImpl extends AbstractEffectiveOperationDefinition<RpcStatement>
- implements RpcDefinition, RpcEffectiveStatement {
- RpcEffectiveStatementImpl(final StmtContext<QName, RpcStatement, RpcEffectiveStatement> ctx) {
- super(ctx);
+final class RpcEffectiveStatementImpl extends WithSubstatements<QName, RpcStatement, RpcEffectiveStatement>
+ implements RpcDefinition, RpcEffectiveStatement, OperationDefinitionMixin<RpcStatement> {
+ private final @NonNull SchemaPath path;
+ private final int flags;
+
+ RpcEffectiveStatementImpl(final RpcStatement declared, final SchemaPath path, final int flags,
+ final StmtContext<QName, RpcStatement, RpcEffectiveStatement> ctx,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(declared, ctx, substatements);
+ this.path = requireNonNull(path);
+ this.flags = flags;
+ }
+
+ @Override
+ public @NonNull SchemaPath getPath() {
+ return path;
+ }
+
+ @Override
+ public int flags() {
+ return flags;
}
}