}
@Override
- public final StatementSource getStatementSource() {
+ public StatementSource getStatementSource() {
return StatementSource.DECLARATION;
}
final D declared, final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
final StatementSource source = ctx.getStatementSource();
final int flags = computeFlags(ctx, substatements);
- switch (ctx.getStatementSource()) {
+ switch (source) {
case CONTEXT:
return createUndeclaredEffective(flags, ctx, substatements);
case DECLARATION:
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.StatementSource;
import org.opendaylight.yangtools.yang.model.api.stmt.InputEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.InputStatement;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseOperationContainerStatementSupport;
@Override
protected final InputStatement createDeclared(final StmtContext<QName, InputStatement, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return new RegularInputStatement(ctx.coerceStatementArgument(), substatements);
+ final StatementSource source = ctx.getStatementSource();
+ switch (ctx.getStatementSource()) {
+ case CONTEXT:
+ return new RegularUndeclaredInputStatement(ctx.coerceStatementArgument(), substatements);
+ case DECLARATION:
+ return new RegularInputStatement(ctx.coerceStatementArgument(), substatements);
+ default:
+ throw new IllegalStateException("Unhandled statement source " + source);
+ }
}
@Override
protected final InputStatement createEmptyDeclared(final StmtContext<QName, InputStatement, ?> ctx) {
- return new EmptyInputStatement(ctx.coerceStatementArgument());
+ final StatementSource source = ctx.getStatementSource();
+ switch (ctx.getStatementSource()) {
+ case CONTEXT:
+ return new EmptyUndeclaredInputStatement(ctx.coerceStatementArgument());
+ case DECLARATION:
+ return new EmptyInputStatement(ctx.coerceStatementArgument());
+ default:
+ throw new IllegalStateException("Unhandled statement source " + source);
+ }
}
@Override
import org.opendaylight.yangtools.yang.model.api.stmt.InputStatement;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithQNameArgument;
-final class EmptyInputStatement extends WithQNameArgument implements InputStatement {
+class EmptyInputStatement extends WithQNameArgument implements InputStatement {
EmptyInputStatement(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.input;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
+
+final class EmptyUndeclaredInputStatement extends EmptyInputStatement {
+ EmptyUndeclaredInputStatement(final QName argument) {
+ super(argument);
+ }
+
+ @Override
+ public StatementSource getStatementSource() {
+ return StatementSource.CONTEXT;
+ }
+}
import org.opendaylight.yangtools.yang.model.api.stmt.InputStatement;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithQNameArgument.WithSubstatements;
-final class RegularInputStatement extends WithSubstatements implements InputStatement {
- RegularInputStatement(final QName argument, final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+class RegularInputStatement extends WithSubstatements implements InputStatement {
+ RegularInputStatement(final QName argument,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
super(argument, substatements);
}
}
--- /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.input;
+
+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.meta.StatementSource;
+
+final class RegularUndeclaredInputStatement extends RegularInputStatement {
+ RegularUndeclaredInputStatement(final QName argument,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ super(argument, substatements);
+ }
+
+ @Override
+ public StatementSource getStatementSource() {
+ return StatementSource.CONTEXT;
+ }
+}
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.StatementSource;
import org.opendaylight.yangtools.yang.model.api.stmt.OutputEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.OutputStatement;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseOperationContainerStatementSupport;
@Override
protected final OutputStatement createDeclared(final StmtContext<QName, OutputStatement, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return new RegularOutputStatement(ctx.coerceStatementArgument(), substatements);
+ final StatementSource source = ctx.getStatementSource();
+ switch (ctx.getStatementSource()) {
+ case CONTEXT:
+ return new RegularUndeclaredOutputStatement(ctx.coerceStatementArgument(), substatements);
+ case DECLARATION:
+ return new RegularOutputStatement(ctx.coerceStatementArgument(), substatements);
+ default:
+ throw new IllegalStateException("Unhandled statement source " + source);
+ }
}
@Override
protected final OutputStatement createEmptyDeclared(final StmtContext<QName, OutputStatement, ?> ctx) {
- return new EmptyOutputStatement(ctx.coerceStatementArgument());
+ final StatementSource source = ctx.getStatementSource();
+ switch (ctx.getStatementSource()) {
+ case CONTEXT:
+ return new EmptyUndeclaredOutputStatement(ctx.coerceStatementArgument());
+ case DECLARATION:
+ return new EmptyOutputStatement(ctx.coerceStatementArgument());
+ default:
+ throw new IllegalStateException("Unhandled statement source " + source);
+ }
}
@Override
import org.opendaylight.yangtools.yang.model.api.stmt.OutputStatement;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithQNameArgument;
-final class EmptyOutputStatement extends WithQNameArgument implements OutputStatement {
+class EmptyOutputStatement extends WithQNameArgument implements OutputStatement {
EmptyOutputStatement(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.output;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
+
+final class EmptyUndeclaredOutputStatement extends EmptyOutputStatement {
+ EmptyUndeclaredOutputStatement(final QName argument) {
+ super(argument);
+ }
+
+ @Override
+ public StatementSource getStatementSource() {
+ return StatementSource.CONTEXT;
+ }
+}
import org.opendaylight.yangtools.yang.model.api.stmt.OutputStatement;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithQNameArgument.WithSubstatements;
-final class RegularOutputStatement extends WithSubstatements implements OutputStatement {
+class RegularOutputStatement extends WithSubstatements implements OutputStatement {
RegularOutputStatement(final QName argument, final ImmutableList<? extends DeclaredStatement<?>> substatements) {
super(argument, substatements);
}
--- /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.output;
+
+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.meta.StatementSource;
+
+final class RegularUndeclaredOutputStatement extends RegularOutputStatement {
+ RegularUndeclaredOutputStatement(final QName argument,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ super(argument, substatements);
+ }
+
+ @Override
+ public StatementSource getStatementSource() {
+ return StatementSource.CONTEXT;
+ }
+}