--- /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;
+
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.annotations.Beta;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
+
+/**
+ * Base stateless superclass for statements which (logically) always have an associated {@link DeclaredStatement}. This
+ * is notably not true for all {@code case} statements, some of which may actually be implied.
+ *
+ * <p>
+ * Note implementations are not strictly required to make the declared statement available, they are free to throw
+ * {@link UnsupportedOperationException} from {@link #getDeclared()}, rendering any services relying on declared
+ * statement to be not available.
+ *
+ * @param <A> Argument type ({@link Void} if statement does not have argument.)
+ * @param <D> Class representing declared version of this statement.
+ */
+@Beta
+public abstract class AbstractDeclaredEffectiveStatement<A, D extends DeclaredStatement<A>>
+ extends AbstractEffectiveStatement<A, D> {
+ @Override
+ public final StatementSource getStatementSource() {
+ return StatementSource.DECLARATION;
+ }
+
+ @Override
+ public final StatementDefinition statementDefinition() {
+ return getDeclared().statementDefinition();
+ }
+
+ @Override
+ public abstract @NonNull D getDeclared();
+
+ /**
+ * A stateful version of {@link AbstractDeclaredEffectiveStatement}, which holds (and requires) a declared
+ * statement.
+ *
+ * @param <A> Argument type ({@link Void} if statement does not have argument.)
+ * @param <D> Class representing declared version of this statement.
+ */
+ public abstract static class Default<A, D extends DeclaredStatement<A>>
+ extends AbstractDeclaredEffectiveStatement<A, D> {
+ private final @NonNull D declared;
+
+ protected Default(final D declared) {
+ this.declared = requireNonNull(declared);
+ }
+
+ @Override
+ public final D getDeclared() {
+ return declared;
+ }
+ }
+
+ /**
+ * An extra building block on top of {@link Default}, which is wiring {@link #argument()} to the declared statement.
+ * This is mostly useful for arguments that are not subject to inference transformation -- for example Strings in
+ * {@code description}, etc. This explicitly is not true of statements which underwent namespace binding via
+ * {@code uses} or similar.
+ *
+ * @param <A> Argument type ({@link Void} if statement does not have argument.)
+ * @param <D> Class representing declared version of this statement.
+ */
+ public abstract static class DefaultArgument<A, D extends DeclaredStatement<A>> extends Default<A, D> {
+ protected DefaultArgument(final D declared) {
+ super(declared);
+ }
+
+ @Override
+ public final @Nullable A argument() {
+ return getDeclared().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;
+
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.ImmutableMap;
+import java.util.Map;
+import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
+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.IdentifierNamespace;
+
+/**
+ * Baseline stateless implementation of an EffectiveStatement. This class adds a few default implementations and
+ * namespace dispatch, but does not actually force any state on its subclasses. This approach is different from
+ * {@link EffectiveStatementBase} in that it adds requirements for an implementation, but it leaves it up to the final
+ * class to provide object layout.
+ *
+ * <p>
+ * This finds immense value in catering the common case, for example effective statements which can, but typically
+ * do not, contain substatements.
+ *
+ * @param <A> Argument type ({@link Void} if statement does not have argument.)
+ * @param <D> Class representing declared version of this statement.
+ */
+@Beta
+public abstract class AbstractEffectiveStatement<A, D extends DeclaredStatement<A>>
+ implements EffectiveStatement<A, D> {
+ @Override
+ public final <K, V, N extends IdentifierNamespace<K, V>> V get(final Class<N> namespace, final K identifier) {
+ return getAll(namespace).get(requireNonNull(identifier));
+ }
+
+ @Override
+ public final <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAll(final Class<N> namespace) {
+ final Optional<? extends Map<K, V>> ret = getNamespaceContents(requireNonNull(namespace));
+ return ret.isPresent() ? ret.get() : ImmutableMap.of();
+ }
+
+ /**
+ * Return the statement-specific contents of specified namespace, if available.
+ *
+ * @param namespace Requested namespace
+ * @return Namespace contents, if available.
+ */
+ protected <K, V, N extends IdentifierNamespace<K, V>> Optional<? extends Map<K, V>> getNamespaceContents(
+ final @NonNull Class<N> namespace) {
+ return Optional.empty();
+ }
+}
--- /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;
+
+import static com.google.common.base.Verify.verifyNotNull;
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.ImmutableList;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.jdt.annotation.NonNull;
+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.parser.spi.meta.AbstractStatementSupport;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+/**
+ * Implementation-internal base class for {@link AbstractStatementSupport} implementations.
+ *
+ * @param <A> Argument type
+ * @param <D> Declared Statement representation
+ * @param <E> Effective Statement representation
+ */
+@Beta
+public abstract class BaseStatementSupport<A, D extends DeclaredStatement<A>,
+ E extends EffectiveStatement<A, D>> extends AbstractStatementSupport<A, D, E> {
+ protected BaseStatementSupport(final StatementDefinition publicDefinition) {
+ super(publicDefinition);
+ }
+
+ @Override
+ public final E createEffective(final StmtContext<A, D, E> ctx) {
+ final D declared = buildDeclared(ctx);
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements = buildEffectiveSubstatements(ctx);
+ return substatements.isEmpty() ? createEmptyEffective(ctx, declared)
+ : createEffective(ctx, declared, substatements);
+ }
+
+ protected abstract @NonNull E createEffective(@NonNull StmtContext<A, D, E> ctx, @NonNull D declared,
+ @NonNull ImmutableList<? extends EffectiveStatement<?, ?>> substatements);
+
+ protected abstract @NonNull E createEmptyEffective(@NonNull StmtContext<A, D, E> ctx, @NonNull D declared);
+
+ static final <A, D extends DeclaredStatement<A>> @NonNull D buildDeclared(final StmtContext<A, D, ?> ctx) {
+ /*
+ * Share original instance of declared statement between all effective
+ * statements which have been copied or derived from this original
+ * declared statement.
+ */
+ @SuppressWarnings("unchecked")
+ final StmtContext<?, D, ?> lookupCtx = (StmtContext<?, D, ?>) ctx.getOriginalCtx().orElse(ctx);
+ return verifyNotNull(lookupCtx.buildDeclared(), "Statement %s failed to build declared statement", lookupCtx);
+ }
+
+ /**
+ * Create a set of substatements. This method is split out so it can be overridden in
+ * ExtensionEffectiveStatementImpl to leak a not-fully-initialized instance.
+ *
+ * @param substatements proposed substatements
+ * @return Filtered substatements
+ */
+ private static ImmutableList<? extends EffectiveStatement<?, ?>> buildEffectiveSubstatements(
+ final List<? extends StmtContext<?, ?, ?>> substatements) {
+ return substatements.stream()
+ .filter(StmtContext::isSupportedToBuildEffective)
+ .map(StmtContext::buildEffective)
+ .collect(ImmutableList.toImmutableList());
+ }
+
+ static final ImmutableList<? extends EffectiveStatement<?, ?>> buildEffectiveSubstatements(
+ final StmtContext<?, ?, ?> ctx) {
+ return buildEffectiveSubstatements(declaredSubstatements(ctx));
+ }
+
+ static final @NonNull List<StmtContext<?, ?, ?>> declaredSubstatements(final StmtContext<?, ?, ?> ctx) {
+ /*
+ * This dance is required to ensure that effects of 'uses' nodes are applied in the same order as
+ * the statements were defined -- i.e. if we have something like this:
+ *
+ * container foo {
+ * uses bar;
+ * uses baz;
+ * }
+ *
+ * grouping baz {
+ * leaf baz {
+ * type string;
+ * }
+ * }
+ *
+ * grouping bar {
+ * leaf bar {
+ * type string;
+ * }
+ * }
+ *
+ * The reactor would first inline 'uses baz' as that definition is the first one completely resolved and then
+ * inline 'uses bar'. Here we are iterating in declaration order re-inline the statements.
+ *
+ * FIXME: 5.0.0: this really should be handled by UsesStatementSupport such that 'uses baz' would have a
+ * prerequisite of a resolved 'uses bar'.
+ */
+ final List<StmtContext<?, ?, ?>> substatementsInit = new ArrayList<>();
+ Set<StmtContext<?, ?, ?>> filteredStatements = null;
+ for (final StmtContext<?, ?, ?> declaredSubstatement : ctx.declaredSubstatements()) {
+ if (declaredSubstatement.isSupportedByFeatures()) {
+ substatementsInit.add(declaredSubstatement);
+
+ final Collection<? extends StmtContext<?, ?, ?>> effect = declaredSubstatement.getEffectOfStatement();
+ if (!effect.isEmpty()) {
+ if (filteredStatements == null) {
+ filteredStatements = new HashSet<>();
+ }
+ filteredStatements.addAll(effect);
+ substatementsInit.addAll(effect);
+ }
+ }
+ }
+
+ if (filteredStatements != null) {
+ for (StmtContext<?, ?, ?> stmt : ctx.effectiveSubstatements()) {
+ if (!filteredStatements.contains(stmt)) {
+ substatementsInit.add(stmt);
+ }
+ }
+ } else {
+ substatementsInit.addAll(ctx.effectiveSubstatements());
+ }
+
+ return substatementsInit;
+ }
+}
--- /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;
+
+import com.google.common.annotations.Beta;
+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;
+
+/**
+ * Specialization of {@link BaseStatementSupport} for String statement arguments.
+ *
+ * @param <D> Declared Statement representation
+ * @param <E> Effective Statement representation
+ */
+@Beta
+public abstract class BaseStringStatementSupport<D extends DeclaredStatement<String>,
+ E extends EffectiveStatement<String, D>> extends BaseStatementSupport<String, D, E> {
+ protected BaseStringStatementSupport(final StatementDefinition publicDefinition) {
+ super(publicDefinition);
+ }
+}
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt;
-import com.google.common.base.Verify;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
*/
protected DeclaredEffectiveStatementBase(final StmtContext<A, D, ?> ctx) {
super(ctx);
-
- this.argument = ctx.getStatementArgument();
- this.statementSource = ctx.getStatementSource();
-
- /*
- * Share original instance of declared statement between all effective
- * statements which have been copied or derived from this original
- * declared statement.
- */
- @SuppressWarnings("unchecked")
- final StmtContext<?, D, ?> lookupCtx = (StmtContext<?, D, ?>) ctx.getOriginalCtx().orElse(ctx);
- declaredInstance = Verify.verifyNotNull(lookupCtx.buildDeclared(),
- "Statement %s failed to build declared statement", lookupCtx);
+ argument = ctx.getStatementArgument();
+ statementSource = ctx.getStatementSource();
+ declaredInstance = BaseStatementSupport.buildDeclared(ctx);
}
@Override
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt;
-import static java.util.Objects.requireNonNull;
-
import com.google.common.annotations.Beta;
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableList;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
import java.util.function.Predicate;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yangtools.yang.model.api.SchemaNode;
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.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
-public abstract class EffectiveStatementBase<A, D extends DeclaredStatement<A>> implements EffectiveStatement<A, D> {
+/**
+ * Stateful version of {@link AbstractEffectiveStatement}, which holds substatements in an {@link ImmutableList}.
+ *
+ * @param <A> Argument type ({@link Void} if statement does not have argument.)
+ * @param <D> Class representing declared version of this statement.
+ */
+// TODO: This class is problematic in that it interacts with its subclasses via methods which are guaranteed to allows
+// atrocities like RecursiveObjectLeaker tricks. That should be avoided and pushed to caller in a way where
+// this class is a pure holder taking {@code ImmutableList<? extends EffectiveStatement<?, ?>>} in the
+// constructor.
+//
+// From memory efficiency perspective, it is very common to have effective statements without any substatements,
+// in which case 'substatements' field is redundant.
+public abstract class EffectiveStatementBase<A, D extends DeclaredStatement<A>>
+ extends AbstractEffectiveStatement<A, D> {
private final @NonNull ImmutableList<? extends EffectiveStatement<?, ?>> substatements;
/**
* @param ctx context of statement.
*/
protected EffectiveStatementBase(final StmtContext<A, D, ?> ctx) {
- final Collection<StmtContext<?, ?, ?>> substatementsInit = new ArrayList<>();
-
- /*
- * This dance is required to ensure that effects of 'uses' nodes are applied in the same order as
- * the statements were defined -- i.e. if we have something like this:
- *
- * container foo {
- * uses bar;
- * uses baz;
- * }
- *
- * grouping baz {
- * leaf baz {
- * type string;
- * }
- * }
- *
- * grouping bar {
- * leaf bar {
- * type string;
- * }
- * }
- *
- * The reactor would first inline 'uses baz' as that definition is the first one completely resolved and then
- * inline 'uses bar'. Here we are iterating in declaration order re-inline the statements.
- *
- * TODO: this really should be handled by UsesStatementSupport such that 'uses baz' would have a prerequisite
- * of a resolved 'uses bar'.
- */
- Set<StmtContext<?, ?, ?>> filteredStatements = null;
- for (final StmtContext<?, ?, ?> declaredSubstatement : ctx.declaredSubstatements()) {
- if (declaredSubstatement.isSupportedByFeatures()) {
- substatementsInit.add(declaredSubstatement);
-
- final Collection<? extends StmtContext<?, ?, ?>> effect = declaredSubstatement.getEffectOfStatement();
- if (!effect.isEmpty()) {
- if (filteredStatements == null) {
- filteredStatements = new HashSet<>();
- }
- filteredStatements.addAll(effect);
- substatementsInit.addAll(effect);
- }
- }
- }
-
- if (filteredStatements != null) {
- for (StmtContext<?, ?, ?> stmt : ctx.effectiveSubstatements()) {
- if (!filteredStatements.contains(stmt)) {
- substatementsInit.add(stmt);
- }
- }
- } else {
- substatementsInit.addAll(ctx.effectiveSubstatements());
- }
-
- this.substatements = ImmutableList.copyOf(initSubstatements(ctx, substatementsInit));
+ this.substatements = ImmutableList.copyOf(initSubstatements(ctx,
+ BaseStatementSupport.declaredSubstatements(ctx)));
}
@Beta
StmtContext::isSupportedToBuildEffective), StmtContext::buildEffective);
}
- @Override
- public final <K, V, N extends IdentifierNamespace<K, V>> V get(final Class<N> namespace, final K identifier) {
- return findAll(namespace).get(requireNonNull(identifier));
- }
-
- @Override
- public final <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAll(final Class<N> namespace) {
- return getNamespaceContents(requireNonNull(namespace)).orElse(null);
- }
-
- /**
- * Return the statement-specific contents of specified namespace, if available.
- *
- * @param namespace Requested namespace
- * @return Namespace contents, if available.
- */
- @Beta
- protected <K, V, N extends IdentifierNamespace<K, V>> Optional<? extends Map<K, V>> getNamespaceContents(
- final @NonNull Class<N> namespace) {
- return Optional.empty();
- }
-
@Override
public final Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
return substatements;
}
- protected final <S extends SchemaNode> S firstSchemaNode(final Class<S> type) {
- return substatements.stream().filter(type::isInstance).findFirst().map(type::cast).orElse(null);
- }
-
@SuppressWarnings("unchecked")
public final <T> Collection<T> allSubstatementsOfType(final Class<T> type) {
- return Collection.class.cast(Collections2.filter(substatements, type::isInstance));
+ return Collection.class.cast(Collections2.filter(effectiveSubstatements(), type::isInstance));
}
protected final <T> @Nullable T firstSubstatementOfType(final Class<T> type) {
- return substatements.stream().filter(type::isInstance).findFirst().map(type::cast).orElse(null);
+ return effectiveSubstatements().stream().filter(type::isInstance).findFirst().map(type::cast).orElse(null);
}
protected final <R> R firstSubstatementOfType(final Class<?> type, final Class<R> returnType) {
- return substatements.stream()
+ return effectiveSubstatements().stream()
.filter(((Predicate<Object>)type::isInstance).and(returnType::isInstance))
.findFirst().map(returnType::cast).orElse(null);
}
protected final EffectiveStatement<?, ?> firstEffectiveSubstatementOfType(final Class<?> type) {
- return substatements.stream().filter(type::isInstance).findFirst().orElse(null);
+ return effectiveSubstatements().stream().filter(type::isInstance).findFirst().orElse(null);
+ }
+
+ // FIXME: rename to 'getFirstEffectiveStatement()'
+ protected final <S extends SchemaNode> S firstSchemaNode(final Class<S> type) {
+ return findFirstEffectiveSubstatement(type).orElse(null);
}
}
/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ * 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,
import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToStatement;
-import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.DeclaredEffectiveStatementBase;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredEffectiveStatement;
-final class BelongsToEffectiveStatementImpl extends DeclaredEffectiveStatementBase<String, BelongsToStatement>
+abstract class AbstractBelongsToEffectiveStatement
+ extends AbstractDeclaredEffectiveStatement.DefaultArgument<String, BelongsToStatement>
implements BelongsToEffectiveStatement {
- BelongsToEffectiveStatementImpl(final StmtContext<String, BelongsToStatement, ?> ctx) {
- super(ctx);
+ AbstractBelongsToEffectiveStatement(final BelongsToStatement declared) {
+ super(declared);
}
}
import static org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils.findFirstDeclaredSubstatement;
+import com.google.common.collect.ImmutableList;
import java.util.Collection;
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.PrefixStatement;
import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
-import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
import org.opendaylight.yangtools.yang.parser.spi.meta.ModelActionBuilder;
import org.opendaylight.yangtools.yang.parser.spi.meta.ModelActionBuilder.InferenceAction;
import org.opendaylight.yangtools.yang.parser.spi.source.BelongsToPrefixToModuleCtx;
import org.opendaylight.yangtools.yang.parser.spi.source.ModuleNamespaceForBelongsTo;
-public final class BelongsToStatementSupport extends
- AbstractStatementSupport<String, BelongsToStatement, EffectiveStatement<String, BelongsToStatement>> {
+public final class BelongsToStatementSupport
+ extends BaseStringStatementSupport<BelongsToStatement, BelongsToEffectiveStatement> {
private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
SubstatementValidator.builder(YangStmtMapping.BELONGS_TO).addMandatory(YangStmtMapping.PREFIX).build();
private static final BelongsToStatementSupport INSTANCE = new BelongsToStatementSupport();
}
@Override
- public BelongsToStatement createDeclared(
- final StmtContext<String, BelongsToStatement, ?> ctx) {
+ public BelongsToStatement createDeclared(final StmtContext<String, BelongsToStatement, ?> ctx) {
return new BelongsToStatementImpl(ctx);
}
@Override
- public EffectiveStatement<String, BelongsToStatement> createEffective(
- final StmtContext<String, BelongsToStatement, EffectiveStatement<String, BelongsToStatement>> ctx) {
- return new BelongsToEffectiveStatementImpl(ctx);
+ public void onPreLinkageDeclared(final Mutable<String, BelongsToStatement, BelongsToEffectiveStatement> ctx) {
+ ctx.addRequiredSource(getSourceIdentifier(ctx));
}
@Override
- public void onPreLinkageDeclared(final StmtContext.Mutable<String, BelongsToStatement,
- EffectiveStatement<String, BelongsToStatement>> belongsToCtx) {
- belongsToCtx.addRequiredSource(getSourceIdentifier(belongsToCtx));
- }
-
- @Override
- public void onLinkageDeclared(final Mutable<String, BelongsToStatement,
- EffectiveStatement<String, BelongsToStatement>> belongsToCtx) {
+ public void onLinkageDeclared(final Mutable<String, BelongsToStatement, BelongsToEffectiveStatement> belongsToCtx) {
ModelActionBuilder belongsToAction = belongsToCtx.newInferenceAction(ModelProcessingPhase.SOURCE_LINKAGE);
final SourceIdentifier belongsToSourceIdentifier = getSourceIdentifier(belongsToCtx);
});
}
+ @Override
+ protected BelongsToEffectiveStatement createEffective(
+ final StmtContext<String, BelongsToStatement, BelongsToEffectiveStatement> ctx,
+ final BelongsToStatement declared, final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new RegularBelongsToEffectiveStatement(declared, substatements);
+ }
+
+ @Override
+ protected BelongsToEffectiveStatement createEmptyEffective(
+ final StmtContext<String, BelongsToStatement, BelongsToEffectiveStatement> ctx,
+ final BelongsToStatement declared) {
+ return new EmptyBelongsToEffectiveStatement(declared);
+ }
+
private static SourceIdentifier getSourceIdentifier(final StmtContext<String, BelongsToStatement,
- EffectiveStatement<String, BelongsToStatement>> belongsToCtx) {
+ BelongsToEffectiveStatement> belongsToCtx) {
return RevisionSourceIdentifier.create(belongsToCtx.coerceStatementArgument());
}
--- /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.belongs_to;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToStatement;
+
+final class EmptyBelongsToEffectiveStatement extends AbstractBelongsToEffectiveStatement {
+ EmptyBelongsToEffectiveStatement(final BelongsToStatement declared) {
+ super(declared);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return ImmutableList.of();
+ }
+}
--- /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.belongs_to;
+
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.collect.ImmutableList;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToStatement;
+
+final class RegularBelongsToEffectiveStatement extends AbstractBelongsToEffectiveStatement {
+ private final @NonNull ImmutableList<? extends EffectiveStatement<?, ?>> substatements;
+
+ RegularBelongsToEffectiveStatement(final BelongsToStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(declared);
+ this.substatements = requireNonNull(substatements);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return substatements;
+ }
+}
/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ * 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,
import org.opendaylight.yangtools.yang.model.api.stmt.ContactEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ContactStatement;
-import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.DeclaredEffectiveStatementBase;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredEffectiveStatement;
-final class ContactEffectiveStatementImpl extends DeclaredEffectiveStatementBase<String, ContactStatement>
+abstract class AbstractContactEffectiveStatement
+ extends AbstractDeclaredEffectiveStatement.DefaultArgument<String, ContactStatement>
implements ContactEffectiveStatement {
- ContactEffectiveStatementImpl(final StmtContext<String, ContactStatement, ?> ctx) {
- super(ctx);
+ AbstractContactEffectiveStatement(final ContactStatement declared) {
+ super(declared);
}
}
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.contact;
+import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ContactEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ContactStatement;
-import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
public final class ContactStatementSupport
- extends AbstractStatementSupport<String, ContactStatement,EffectiveStatement<String, ContactStatement>> {
+ extends BaseStringStatementSupport<ContactStatement, ContactEffectiveStatement> {
private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(
YangStmtMapping.CONTACT).build();
private static final ContactStatementSupport INSTANCE = new ContactStatementSupport();
}
@Override
- public EffectiveStatement<String, ContactStatement> createEffective(
- final StmtContext<String, ContactStatement, EffectiveStatement<String, ContactStatement>> ctx) {
- return new ContactEffectiveStatementImpl(ctx);
+ protected SubstatementValidator getSubstatementValidator() {
+ return SUBSTATEMENT_VALIDATOR;
}
@Override
- protected SubstatementValidator getSubstatementValidator() {
- return SUBSTATEMENT_VALIDATOR;
+ protected ContactEffectiveStatement createEffective(
+ final StmtContext<String, ContactStatement, ContactEffectiveStatement> ctx,
+ final ContactStatement declared, final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new RegularContactEffectiveStatement(declared, substatements);
+ }
+
+ @Override
+ protected ContactEffectiveStatement createEmptyEffective(
+ final StmtContext<String, ContactStatement, ContactEffectiveStatement> ctx,
+ final ContactStatement declared) {
+ return new EmptyContactEffectiveStatement(declared);
}
}
\ No newline at end of file
--- /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.contact;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ContactStatement;
+
+final class EmptyContactEffectiveStatement extends AbstractContactEffectiveStatement {
+ EmptyContactEffectiveStatement(final ContactStatement declared) {
+ super(declared);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return ImmutableList.of();
+ }
+}
--- /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.contact;
+
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.collect.ImmutableList;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ContactStatement;
+
+final class RegularContactEffectiveStatement extends AbstractContactEffectiveStatement {
+ private final @NonNull ImmutableList<? extends EffectiveStatement<?, ?>> substatements;
+
+ RegularContactEffectiveStatement(final ContactStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(declared);
+ this.substatements = requireNonNull(substatements);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return substatements;
+ }
+}
/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ * 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,
import org.opendaylight.yangtools.yang.model.api.stmt.DefaultEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.DefaultStatement;
-import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.DeclaredEffectiveStatementBase;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredEffectiveStatement;
-final class DefaultEffectiveStatementImpl extends DeclaredEffectiveStatementBase<String, DefaultStatement>
+abstract class AbstractDefaultEffectiveStatement
+ extends AbstractDeclaredEffectiveStatement.DefaultArgument<String, DefaultStatement>
implements DefaultEffectiveStatement {
- DefaultEffectiveStatementImpl(final StmtContext<String, DefaultStatement, ?> ctx) {
- super(ctx);
+ AbstractDefaultEffectiveStatement(final DefaultStatement declared) {
+ super(declared);
}
-}
\ No newline at end of file
+}
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.default_;
+import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.DefaultEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.DefaultStatement;
-import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
public final class DefaultStatementSupport
- extends AbstractStatementSupport<String, DefaultStatement, EffectiveStatement<String, DefaultStatement>> {
+ extends BaseStringStatementSupport<DefaultStatement, DefaultEffectiveStatement> {
private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(
YangStmtMapping.DEFAULT).build();
private static final DefaultStatementSupport INSTANCE = new DefaultStatementSupport();
}
@Override
- public EffectiveStatement<String, DefaultStatement> createEffective(
- final StmtContext<String, DefaultStatement, EffectiveStatement<String, DefaultStatement>> ctx) {
- return new DefaultEffectiveStatementImpl(ctx);
+ protected SubstatementValidator getSubstatementValidator() {
+ return SUBSTATEMENT_VALIDATOR;
}
@Override
- protected SubstatementValidator getSubstatementValidator() {
- return SUBSTATEMENT_VALIDATOR;
+ protected DefaultEffectiveStatement createEffective(
+ final StmtContext<String, DefaultStatement, DefaultEffectiveStatement> ctx,
+ final DefaultStatement declared, final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new RegularDefaultEffectiveStatement(declared, substatements);
+ }
+
+ @Override
+ protected DefaultEffectiveStatement createEmptyEffective(
+ final StmtContext<String, DefaultStatement, DefaultEffectiveStatement> ctx,
+ final DefaultStatement declared) {
+ return new EmptyDefaultEffectiveStatement(declared);
}
}
\ No newline at end of file
--- /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.default_;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.DefaultStatement;
+
+final class EmptyDefaultEffectiveStatement extends AbstractDefaultEffectiveStatement {
+ EmptyDefaultEffectiveStatement(final DefaultStatement declared) {
+ super(declared);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return ImmutableList.of();
+ }
+}
--- /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.default_;
+
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.collect.ImmutableList;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.DefaultStatement;
+
+final class RegularDefaultEffectiveStatement extends AbstractDefaultEffectiveStatement {
+ private final @NonNull ImmutableList<? extends EffectiveStatement<?, ?>> substatements;
+
+ RegularDefaultEffectiveStatement(final DefaultStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(declared);
+ this.substatements = requireNonNull(substatements);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return 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.description;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredEffectiveStatement;
+
+abstract class AbstractDescriptionEffectiveStatement
+ extends AbstractDeclaredEffectiveStatement.DefaultArgument<String, DescriptionStatement>
+ implements DescriptionEffectiveStatement {
+ AbstractDescriptionEffectiveStatement(final DescriptionStatement declared) {
+ super(declared);
+ }
+}
+++ /dev/null
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. 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.description;
-
-import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionEffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
-import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.DeclaredEffectiveStatementBase;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
-
-final class DescriptionEffectiveStatementImpl
- extends DeclaredEffectiveStatementBase<String, DescriptionStatement> implements DescriptionEffectiveStatement {
- DescriptionEffectiveStatementImpl(final StmtContext<String, DescriptionStatement, ?> ctx) {
- super(ctx);
- }
-}
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.description;
+import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
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.DescriptionStatement;
-import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
-public final class DescriptionStatementSupport extends AbstractStatementSupport<String, DescriptionStatement,
- EffectiveStatement<String, DescriptionStatement>> {
+public final class DescriptionStatementSupport
+ extends BaseStringStatementSupport<DescriptionStatement, DescriptionEffectiveStatement> {
private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(
YangStmtMapping.DESCRIPTION).build();
private static final DescriptionStatementSupport INSTANCE = new DescriptionStatementSupport();
}
@Override
- public EffectiveStatement<String, DescriptionStatement> createEffective(
- final StmtContext<String, DescriptionStatement, EffectiveStatement<String, DescriptionStatement>> ctx) {
- return new DescriptionEffectiveStatementImpl(ctx);
+ protected SubstatementValidator getSubstatementValidator() {
+ return SUBSTATEMENT_VALIDATOR;
}
@Override
- protected SubstatementValidator getSubstatementValidator() {
- return SUBSTATEMENT_VALIDATOR;
+ protected DescriptionEffectiveStatement createEffective(
+ final StmtContext<String, DescriptionStatement, DescriptionEffectiveStatement> ctx,
+ final DescriptionStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new RegularDescriptionEffectiveStatement(declared, substatements);
+ }
+
+ @Override
+ protected DescriptionEffectiveStatement createEmptyEffective(
+ final StmtContext<String, DescriptionStatement, DescriptionEffectiveStatement> ctx,
+ final DescriptionStatement declared) {
+ return new EmptyDescriptionEffectiveStatement(declared);
}
}
\ No newline at end of file
--- /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.description;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
+
+final class EmptyDescriptionEffectiveStatement extends AbstractDescriptionEffectiveStatement {
+ EmptyDescriptionEffectiveStatement(final DescriptionStatement declared) {
+ super(declared);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return ImmutableList.of();
+ }
+}
--- /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.description;
+
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.collect.ImmutableList;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
+
+final class RegularDescriptionEffectiveStatement extends AbstractDescriptionEffectiveStatement {
+ private final @NonNull ImmutableList<? extends EffectiveStatement<?, ?>> substatements;
+
+ RegularDescriptionEffectiveStatement(final DescriptionStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(declared);
+ this.substatements = requireNonNull(substatements);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return substatements;
+ }
+}
/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ * 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,
import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
-import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.DeclaredEffectiveStatementBase;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredEffectiveStatement;
-final class ErrorAppTagEffectiveStatementImpl extends DeclaredEffectiveStatementBase<String, ErrorAppTagStatement>
+abstract class AbstractErrorAppTagEffectiveStatement
+ extends AbstractDeclaredEffectiveStatement.DefaultArgument<String, ErrorAppTagStatement>
implements ErrorAppTagEffectiveStatement {
- ErrorAppTagEffectiveStatementImpl(final StmtContext<String, ErrorAppTagStatement, ?> ctx) {
- super(ctx);
+ AbstractErrorAppTagEffectiveStatement(final ErrorAppTagStatement declared) {
+ super(declared);
}
-}
\ No newline at end of file
+}
--- /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.error_app_tag;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
+
+final class EmptyErrorAppTagEffectiveStatement extends AbstractErrorAppTagEffectiveStatement {
+ EmptyErrorAppTagEffectiveStatement(final ErrorAppTagStatement declared) {
+ super(declared);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return ImmutableList.of();
+ }
+}
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.error_app_tag;
+import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
-import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
-public final class ErrorAppTagStatementSupport extends
- AbstractStatementSupport<String, ErrorAppTagStatement, EffectiveStatement<String, ErrorAppTagStatement>> {
+public final class ErrorAppTagStatementSupport
+ extends BaseStringStatementSupport<ErrorAppTagStatement, ErrorAppTagEffectiveStatement> {
private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(
YangStmtMapping.ERROR_APP_TAG).build();
private static final ErrorAppTagStatementSupport INSTANCE = new ErrorAppTagStatementSupport();
}
@Override
- public ErrorAppTagStatement createDeclared(
- final StmtContext<String, ErrorAppTagStatement, ?> ctx) {
+ public ErrorAppTagStatement createDeclared(final StmtContext<String, ErrorAppTagStatement, ?> ctx) {
return new ErrorAppTagStatementImpl(ctx);
}
@Override
- public EffectiveStatement<String, ErrorAppTagStatement> createEffective(
- final StmtContext<String, ErrorAppTagStatement, EffectiveStatement<String, ErrorAppTagStatement>> ctx) {
- return new ErrorAppTagEffectiveStatementImpl(ctx);
+ protected SubstatementValidator getSubstatementValidator() {
+ return SUBSTATEMENT_VALIDATOR;
}
@Override
- protected SubstatementValidator getSubstatementValidator() {
- return SUBSTATEMENT_VALIDATOR;
+ protected ErrorAppTagEffectiveStatement createEffective(
+ final StmtContext<String, ErrorAppTagStatement, ErrorAppTagEffectiveStatement> ctx,
+ final ErrorAppTagStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new RegularErrorAppTagEffectiveStatement(declared, substatements);
+ }
+
+ @Override
+ protected ErrorAppTagEffectiveStatement createEmptyEffective(
+ final StmtContext<String, ErrorAppTagStatement, ErrorAppTagEffectiveStatement> ctx,
+ final ErrorAppTagStatement declared) {
+ return new EmptyErrorAppTagEffectiveStatement(declared);
}
}
\ No newline at end of file
--- /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.error_app_tag;
+
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.collect.ImmutableList;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
+
+final class RegularErrorAppTagEffectiveStatement extends AbstractErrorAppTagEffectiveStatement {
+ private final @NonNull ImmutableList<? extends EffectiveStatement<?, ?>> substatements;
+
+ RegularErrorAppTagEffectiveStatement(final ErrorAppTagStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(declared);
+ this.substatements = requireNonNull(substatements);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return substatements;
+ }
+}
/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ * 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,
import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
-import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.DeclaredEffectiveStatementBase;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredEffectiveStatement;
-final class ErrorMessageEffectiveStatementImpl extends DeclaredEffectiveStatementBase<String, ErrorMessageStatement>
+abstract class AbstractErrorMessageEffectiveStatement
+ extends AbstractDeclaredEffectiveStatement.DefaultArgument<String, ErrorMessageStatement>
implements ErrorMessageEffectiveStatement {
- ErrorMessageEffectiveStatementImpl(final StmtContext<String, ErrorMessageStatement, ?> ctx) {
- super(ctx);
+ AbstractErrorMessageEffectiveStatement(final ErrorMessageStatement declared) {
+ super(declared);
}
-}
\ No newline at end of file
+}
--- /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.error_message;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
+
+final class EmptyErrorMessageEffectiveStatement extends AbstractErrorMessageEffectiveStatement {
+ EmptyErrorMessageEffectiveStatement(final ErrorMessageStatement declared) {
+ super(declared);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return ImmutableList.of();
+ }
+}
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.error_message;
+import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
-import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
-public final class ErrorMessageStatementSupport extends
- AbstractStatementSupport<String, ErrorMessageStatement, EffectiveStatement<String, ErrorMessageStatement>> {
- private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(YangStmtMapping
- .ERROR_MESSAGE)
- .build();
+public final class ErrorMessageStatementSupport
+ extends BaseStringStatementSupport<ErrorMessageStatement, ErrorMessageEffectiveStatement> {
+ private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
+ SubstatementValidator.builder(YangStmtMapping.ERROR_MESSAGE).build();
private static final ErrorMessageStatementSupport INSTANCE = new ErrorMessageStatementSupport();
private ErrorMessageStatementSupport() {
}
@Override
- public EffectiveStatement<String, ErrorMessageStatement> createEffective(
- final StmtContext<String, ErrorMessageStatement,
- EffectiveStatement<String, ErrorMessageStatement>> ctx) {
- return new ErrorMessageEffectiveStatementImpl(ctx);
+ protected SubstatementValidator getSubstatementValidator() {
+ return SUBSTATEMENT_VALIDATOR;
}
@Override
- protected SubstatementValidator getSubstatementValidator() {
- return SUBSTATEMENT_VALIDATOR;
+ protected ErrorMessageEffectiveStatement createEffective(
+ final StmtContext<String, ErrorMessageStatement, ErrorMessageEffectiveStatement> ctx,
+ final ErrorMessageStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new RegularErrorMessageEffectiveStatement(declared, substatements);
+ }
+
+ @Override
+ protected ErrorMessageEffectiveStatement createEmptyEffective(
+ final StmtContext<String, ErrorMessageStatement, ErrorMessageEffectiveStatement> ctx,
+ final ErrorMessageStatement declared) {
+ return new EmptyErrorMessageEffectiveStatement(declared);
}
-}
\ No newline at end of file
+}
--- /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.error_message;
+
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.collect.ImmutableList;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
+
+final class RegularErrorMessageEffectiveStatement extends AbstractErrorMessageEffectiveStatement {
+ private final @NonNull ImmutableList<? extends EffectiveStatement<?, ?>> substatements;
+
+ RegularErrorMessageEffectiveStatement(final ErrorMessageStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(declared);
+ this.substatements = requireNonNull(substatements);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return substatements;
+ }
+}
/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ * 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,
import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByStatement;
-import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.DeclaredEffectiveStatementBase;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredEffectiveStatement;
-final class OrderedByEffectiveStatementImpl extends DeclaredEffectiveStatementBase<String, OrderedByStatement>
+abstract class AbstractOrderedByEffectiveStatement
+ extends AbstractDeclaredEffectiveStatement.DefaultArgument<String, OrderedByStatement>
implements OrderedByEffectiveStatement {
- OrderedByEffectiveStatementImpl(final StmtContext<String, OrderedByStatement, ?> ctx) {
- super(ctx);
+ AbstractOrderedByEffectiveStatement(final OrderedByStatement declared) {
+ super(declared);
}
-}
\ No newline at end of file
+}
--- /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.ordered_by;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByStatement;
+
+final class EmptyOrderedByEffectiveStatement extends AbstractOrderedByEffectiveStatement {
+ EmptyOrderedByEffectiveStatement(final OrderedByStatement declared) {
+ super(declared);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return ImmutableList.of();
+ }
+}
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.ordered_by;
+import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByStatement;
-import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
public final class OrderedByStatementSupport
- extends AbstractStatementSupport<String, OrderedByStatement, EffectiveStatement<String, OrderedByStatement>> {
- private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(
- YangStmtMapping.ORDERED_BY)
- .build();
+ extends BaseStringStatementSupport<OrderedByStatement, OrderedByEffectiveStatement> {
+ private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
+ SubstatementValidator.builder(YangStmtMapping.ORDERED_BY).build();
private static final OrderedByStatementSupport INSTANCE = new OrderedByStatementSupport();
private OrderedByStatementSupport() {
}
@Override
- public EffectiveStatement<String, OrderedByStatement> createEffective(
- final StmtContext<String, OrderedByStatement, EffectiveStatement<String, OrderedByStatement>> ctx) {
- return new OrderedByEffectiveStatementImpl(ctx);
+ protected SubstatementValidator getSubstatementValidator() {
+ return SUBSTATEMENT_VALIDATOR;
}
@Override
- protected SubstatementValidator getSubstatementValidator() {
- return SUBSTATEMENT_VALIDATOR;
+ protected OrderedByEffectiveStatement createEffective(
+ final StmtContext<String, OrderedByStatement, OrderedByEffectiveStatement> ctx,
+ final OrderedByStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new RegularOrderedByEffectiveStatement(declared, substatements);
+ }
+
+ @Override
+ protected OrderedByEffectiveStatement createEmptyEffective(
+ final StmtContext<String, OrderedByStatement, OrderedByEffectiveStatement> ctx,
+ final OrderedByStatement declared) {
+ return new EmptyOrderedByEffectiveStatement(declared);
}
@Override
--- /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.ordered_by;
+
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.collect.ImmutableList;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByStatement;
+
+final class RegularOrderedByEffectiveStatement extends AbstractOrderedByEffectiveStatement {
+ private final @NonNull ImmutableList<? extends EffectiveStatement<?, ?>> substatements;
+
+ RegularOrderedByEffectiveStatement(final OrderedByStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(declared);
+ this.substatements = requireNonNull(substatements);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return substatements;
+ }
+}
/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ * 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,
import org.opendaylight.yangtools.yang.model.api.stmt.PrefixEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.PrefixStatement;
-import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.DeclaredEffectiveStatementBase;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredEffectiveStatement;
-final class PrefixEffectiveStatementImpl extends DeclaredEffectiveStatementBase<String, PrefixStatement>
+abstract class AbstractPrefixEffectiveStatement
+ extends AbstractDeclaredEffectiveStatement.DefaultArgument<String, PrefixStatement>
implements PrefixEffectiveStatement {
- PrefixEffectiveStatementImpl(final StmtContext<String, PrefixStatement, ?> ctx) {
- super(ctx);
+ AbstractPrefixEffectiveStatement(final PrefixStatement declared) {
+ super(declared);
}
}
--- /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.prefix;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.PrefixStatement;
+
+final class EmptyPrefixEffectiveStatement extends AbstractPrefixEffectiveStatement {
+ EmptyPrefixEffectiveStatement(final PrefixStatement declared) {
+ super(declared);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return ImmutableList.of();
+ }
+}
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.prefix;
+import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.PrefixEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.PrefixStatement;
-import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
public final class PrefixStatementSupport
- extends AbstractStatementSupport<String, PrefixStatement, EffectiveStatement<String, PrefixStatement>> {
- private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(YangStmtMapping
- .PREFIX)
- .build();
+ extends BaseStringStatementSupport<PrefixStatement, PrefixEffectiveStatement> {
+ private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
+ SubstatementValidator.builder(YangStmtMapping.PREFIX).build();
private static final PrefixStatementSupport INSTANCE = new PrefixStatementSupport();
private PrefixStatementSupport() {
}
@Override
- public EffectiveStatement<String,PrefixStatement> createEffective(
- final StmtContext<String, PrefixStatement, EffectiveStatement<String, PrefixStatement>> ctx) {
- return new PrefixEffectiveStatementImpl(ctx);
+ protected SubstatementValidator getSubstatementValidator() {
+ return SUBSTATEMENT_VALIDATOR;
}
@Override
- protected SubstatementValidator getSubstatementValidator() {
- return SUBSTATEMENT_VALIDATOR;
+ protected PrefixEffectiveStatement createEffective(
+ final StmtContext<String, PrefixStatement, PrefixEffectiveStatement> ctx, final PrefixStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new RegularPrefixEffectiveStatement(declared, substatements);
+ }
+
+ @Override
+ protected PrefixEffectiveStatement createEmptyEffective(
+ final StmtContext<String, PrefixStatement, PrefixEffectiveStatement> ctx, final PrefixStatement declared) {
+ return new EmptyPrefixEffectiveStatement(declared);
}
-}
\ No newline at end of file
+}
--- /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.prefix;
+
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.collect.ImmutableList;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.PrefixStatement;
+
+final class RegularPrefixEffectiveStatement extends AbstractPrefixEffectiveStatement {
+ private final @NonNull ImmutableList<? extends EffectiveStatement<?, ?>> substatements;
+
+ RegularPrefixEffectiveStatement(final PrefixStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(declared);
+ this.substatements = requireNonNull(substatements);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return substatements;
+ }
+}
/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ * 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,
import org.opendaylight.yangtools.yang.model.api.stmt.PresenceEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.PresenceStatement;
-import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.DeclaredEffectiveStatementBase;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredEffectiveStatement;
-final class PresenceEffectiveStatementImpl extends DeclaredEffectiveStatementBase<String, PresenceStatement>
+abstract class AbstractPresenceEffectiveStatement
+ extends AbstractDeclaredEffectiveStatement.DefaultArgument<String, PresenceStatement>
implements PresenceEffectiveStatement {
- PresenceEffectiveStatementImpl(final StmtContext<String, PresenceStatement, ?> ctx) {
- super(ctx);
+ AbstractPresenceEffectiveStatement(final PresenceStatement declared) {
+ super(declared);
}
}
--- /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.presence;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.PresenceStatement;
+
+final class EmptyPresenceEffectiveStatement extends AbstractPresenceEffectiveStatement {
+ EmptyPresenceEffectiveStatement(final PresenceStatement declared) {
+ super(declared);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return ImmutableList.of();
+ }
+}
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.presence;
+import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.PresenceEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.PresenceStatement;
-import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
public final class PresenceStatementSupport
- extends AbstractStatementSupport<String, PresenceStatement, EffectiveStatement<String, PresenceStatement>> {
- private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(YangStmtMapping
- .PRESENCE)
- .build();
+ extends BaseStringStatementSupport<PresenceStatement, PresenceEffectiveStatement> {
+ private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
+ SubstatementValidator.builder(YangStmtMapping.PRESENCE).build();
private static final PresenceStatementSupport INSTANCE = new PresenceStatementSupport();
private PresenceStatementSupport() {
}
@Override
- public EffectiveStatement<String, PresenceStatement> createEffective(
- final StmtContext<String, PresenceStatement, EffectiveStatement<String, PresenceStatement>> ctx) {
- return new PresenceEffectiveStatementImpl(ctx);
+ protected SubstatementValidator getSubstatementValidator() {
+ return SUBSTATEMENT_VALIDATOR;
}
@Override
- protected SubstatementValidator getSubstatementValidator() {
- return SUBSTATEMENT_VALIDATOR;
+ protected PresenceEffectiveStatement createEffective(
+ final StmtContext<String, PresenceStatement, PresenceEffectiveStatement> ctx,
+ final PresenceStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new RegularPresenceEffectiveStatement(declared, substatements);
+ }
+
+ @Override
+ protected PresenceEffectiveStatement createEmptyEffective(
+ final StmtContext<String, PresenceStatement, PresenceEffectiveStatement> ctx,
+ final PresenceStatement declared) {
+ return new EmptyPresenceEffectiveStatement(declared);
}
}
\ No newline at end of file
--- /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.presence;
+
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.collect.ImmutableList;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.PresenceStatement;
+
+final class RegularPresenceEffectiveStatement extends AbstractPresenceEffectiveStatement {
+ private final @NonNull ImmutableList<? extends EffectiveStatement<?, ?>> substatements;
+
+ RegularPresenceEffectiveStatement(final PresenceStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(declared);
+ this.substatements = requireNonNull(substatements);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return substatements;
+ }
+}
/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ * 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,
import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
-import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.DeclaredEffectiveStatementBase;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredEffectiveStatement;
-final class ReferenceEffectiveStatementImpl extends DeclaredEffectiveStatementBase<String, ReferenceStatement>
+abstract class AbstractReferenceEffectiveStatement
+ extends AbstractDeclaredEffectiveStatement.DefaultArgument<String, ReferenceStatement>
implements ReferenceEffectiveStatement {
- ReferenceEffectiveStatementImpl(final StmtContext<String, ReferenceStatement, ?> ctx) {
- super(ctx);
+ AbstractReferenceEffectiveStatement(final ReferenceStatement declared) {
+ super(declared);
}
}
--- /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.reference;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
+
+final class EmptyReferenceEffectiveStatement extends AbstractReferenceEffectiveStatement {
+ EmptyReferenceEffectiveStatement(final ReferenceStatement declared) {
+ super(declared);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return ImmutableList.of();
+ }
+}
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.reference;
+import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
-import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
-public final class ReferenceStatementSupport extends AbstractStatementSupport<String, ReferenceStatement,
- EffectiveStatement<String, ReferenceStatement>> {
+public final class ReferenceStatementSupport
+ extends BaseStringStatementSupport<ReferenceStatement, ReferenceEffectiveStatement> {
private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(
YangStmtMapping.REFERENCE)
.build();
}
@Override
- public EffectiveStatement<String, ReferenceStatement> createEffective(
- final StmtContext<String, ReferenceStatement, EffectiveStatement<String, ReferenceStatement>> ctx) {
- return new ReferenceEffectiveStatementImpl(ctx);
+ protected SubstatementValidator getSubstatementValidator() {
+ return SUBSTATEMENT_VALIDATOR;
}
@Override
- protected SubstatementValidator getSubstatementValidator() {
- return SUBSTATEMENT_VALIDATOR;
+ protected ReferenceEffectiveStatement createEffective(
+ final StmtContext<String, ReferenceStatement, ReferenceEffectiveStatement> ctx,
+ final ReferenceStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new RegularReferenceEffectiveStatement(declared, substatements);
+ }
+
+ @Override
+ protected ReferenceEffectiveStatement createEmptyEffective(
+ final StmtContext<String, ReferenceStatement, ReferenceEffectiveStatement> ctx,
+ final ReferenceStatement declared) {
+ return new EmptyReferenceEffectiveStatement(declared);
}
}
\ No newline at end of file
--- /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.reference;
+
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.collect.ImmutableList;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
+
+final class RegularReferenceEffectiveStatement extends AbstractReferenceEffectiveStatement {
+ private final @NonNull ImmutableList<? extends EffectiveStatement<?, ?>> substatements;
+
+ RegularReferenceEffectiveStatement(final ReferenceStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(declared);
+ this.substatements = requireNonNull(substatements);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return substatements;
+ }
+}
/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ * 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,
import org.opendaylight.yangtools.yang.model.api.stmt.UnitsEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.UnitsStatement;
-import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.DeclaredEffectiveStatementBase;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredEffectiveStatement;
-final class UnitsEffectiveStatementImpl extends DeclaredEffectiveStatementBase<String, UnitsStatement>
+abstract class AbstractUnitsEffectiveStatement
+ extends AbstractDeclaredEffectiveStatement.DefaultArgument<String, UnitsStatement>
implements UnitsEffectiveStatement {
- UnitsEffectiveStatementImpl(final StmtContext<String, UnitsStatement, ?> ctx) {
- super(ctx);
+ AbstractUnitsEffectiveStatement(final UnitsStatement declared) {
+ super(declared);
}
}
--- /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.units;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.UnitsStatement;
+
+final class EmptyUnitsEffectiveStatement extends AbstractUnitsEffectiveStatement {
+ EmptyUnitsEffectiveStatement(final UnitsStatement declared) {
+ super(declared);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return ImmutableList.of();
+ }
+}
--- /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.units;
+
+import static java.util.Objects.requireNonNull;
+
+import com.google.common.collect.ImmutableList;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.UnitsStatement;
+
+final class RegularUnitsEffectiveStatement extends AbstractUnitsEffectiveStatement {
+ private final @NonNull ImmutableList<? extends EffectiveStatement<?, ?>> substatements;
+
+ RegularUnitsEffectiveStatement(final UnitsStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(declared);
+ this.substatements = requireNonNull(substatements);
+ }
+
+ @Override
+ public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+ return substatements;
+ }
+}
*/
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.units;
+import com.google.common.collect.ImmutableList;
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.UnitsEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.UnitsStatement;
-import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
public final class UnitsStatementSupport
- extends AbstractStatementSupport<String, UnitsStatement, EffectiveStatement<String, UnitsStatement>> {
+ extends BaseStringStatementSupport<UnitsStatement, UnitsEffectiveStatement> {
private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(
YangStmtMapping.UNITS)
.build();
}
@Override
- public UnitsStatement createDeclared(
- final StmtContext<String, UnitsStatement, ?> ctx) {
+ public UnitsStatement createDeclared(final StmtContext<String, UnitsStatement, ?> ctx) {
return new UnitsStatementImpl(ctx);
}
@Override
- public EffectiveStatement<String, UnitsStatement> createEffective(
- final StmtContext<String, UnitsStatement, EffectiveStatement<String, UnitsStatement>> ctx) {
- return new UnitsEffectiveStatementImpl(ctx);
+ protected SubstatementValidator getSubstatementValidator() {
+ return SUBSTATEMENT_VALIDATOR;
}
@Override
- protected SubstatementValidator getSubstatementValidator() {
- return SUBSTATEMENT_VALIDATOR;
+ protected UnitsEffectiveStatement createEffective(
+ final StmtContext<String, UnitsStatement, UnitsEffectiveStatement> ctx,
+ final UnitsStatement declared, final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new RegularUnitsEffectiveStatement(declared, substatements);
+ }
+
+ @Override
+ protected UnitsEffectiveStatement createEmptyEffective(
+ final StmtContext<String, UnitsStatement, UnitsEffectiveStatement> ctx,
+ final UnitsStatement declared) {
+ return new EmptyUnitsEffectiveStatement(declared);
}
}
\ No newline at end of file