package org.opendaylight.yangtools.yang.model.api.stmt;
import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
@Beta
public interface IncludeEffectiveStatement extends EffectiveStatement<String, IncludeStatement> {
-
+ @Override
+ default StatementDefinition statementDefinition() {
+ return YangStmtMapping.INCLUDE;
+ }
}
import java.util.Optional;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
+import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
public interface IncludeStatement extends DocumentedDeclaredStatement<String> {
+ @Override
+ default StatementDefinition statementDefinition() {
+ return YangStmtMapping.INCLUDE;
+ }
+
default @NonNull String getModule() {
// FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here
return verifyNotNull(argument());
import static org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase.SOURCE_LINKAGE;
import static org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils.findFirstDeclaredSubstatement;
+import com.google.common.collect.ImmutableList;
import java.util.Collection;
import java.util.Optional;
import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.IncludeEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.IncludeStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.RevisionDateStatement;
import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.SubmoduleNamespace;
-import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
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.IncludedSubmoduleNameToModuleCtx;
abstract class AbstractIncludeStatementSupport
- extends AbstractStatementSupport<String, IncludeStatement, IncludeEffectiveStatement> {
+ extends BaseStringStatementSupport<IncludeStatement, IncludeEffectiveStatement> {
AbstractIncludeStatementSupport() {
super(YangStmtMapping.INCLUDE);
}
- @Override
- public final String parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
- return value;
- }
-
- @Override
- public final IncludeStatement createDeclared(final StmtContext<String, IncludeStatement, ?> ctx) {
- return new IncludeStatementImpl(ctx);
- }
-
- @Override
- public final IncludeEffectiveStatement createEffective(
- final StmtContext<String, IncludeStatement, IncludeEffectiveStatement> ctx) {
- return new IncludeEffectiveStatementImpl(ctx);
- }
-
@Override
public final void onPreLinkageDeclared(final Mutable<String, IncludeStatement, IncludeEffectiveStatement> stmt) {
final StmtContext<Revision, ?, ?> revision = findFirstDeclaredSubstatement(stmt,
}
});
}
-}
\ No newline at end of file
+
+ @Override
+ protected final IncludeStatement createDeclared(final StmtContext<String, IncludeStatement, ?> ctx,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ return new RegularIncludeStatement(ctx, substatements);
+ }
+
+ @Override
+ protected final IncludeStatement createEmptyDeclared(final StmtContext<String, IncludeStatement, ?> ctx) {
+ return new EmptyIncludeStatement(ctx);
+ }
+
+ @Override
+ protected final IncludeEffectiveStatement createEffective(
+ final StmtContext<String, IncludeStatement, IncludeEffectiveStatement> ctx,
+ final IncludeStatement declared, final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ return new RegularIncludeEffectiveStatement(declared, substatements);
+ }
+
+ @Override
+ protected final IncludeEffectiveStatement createEmptyEffective(
+ final StmtContext<String, IncludeStatement, IncludeEffectiveStatement> ctx,
+ final IncludeStatement declared) {
+ return new EmptyIncludeEffectiveStatement(declared);
+ }
+}
/*
- * 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.IncludeEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.IncludeStatement;
-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.DefaultArgument;
-final class IncludeEffectiveStatementImpl extends DeclaredEffectiveStatementBase<String, IncludeStatement>
+final class EmptyIncludeEffectiveStatement extends DefaultArgument<String, IncludeStatement>
implements IncludeEffectiveStatement {
- IncludeEffectiveStatementImpl(final StmtContext<String, IncludeStatement, ?> ctx) {
- super(ctx);
+ EmptyIncludeEffectiveStatement(final IncludeStatement declared) {
+ super(declared);
}
-}
\ No newline at end of file
+}
/*
- * 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,
package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.include;
import org.opendaylight.yangtools.yang.model.api.stmt.IncludeStatement;
-import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithArgument;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
-final class IncludeStatementImpl extends AbstractDeclaredStatement<String> implements IncludeStatement {
- IncludeStatementImpl(final StmtContext<String, IncludeStatement, ?> context) {
+final class EmptyIncludeStatement extends WithArgument<String> implements IncludeStatement {
+ EmptyIncludeStatement(final StmtContext<String, ?, ?> context) {
super(context);
}
}
--- /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.include;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.IncludeEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.IncludeStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredEffectiveStatement.DefaultArgument.WithSubstatements;
+
+final class RegularIncludeEffectiveStatement extends WithSubstatements<String, IncludeStatement>
+ implements IncludeEffectiveStatement {
+ RegularIncludeEffectiveStatement(final IncludeStatement declared,
+ final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+ super(declared, 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.include;
+
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.IncludeStatement;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithArgument.WithSubstatements;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+final class RegularIncludeStatement extends WithSubstatements<String> implements IncludeStatement {
+ RegularIncludeStatement(final StmtContext<String, ?, ?> context,
+ final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ super(context, substatements);
+ }
+}