+++ /dev/null
-/*
- * Copyright (c) 2018 Pantheon Technologies, 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.model.api.stmt;
-
-import com.google.common.annotations.Beta;
-import java.util.Collection;
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.common.UnresolvedQName.Unqualified;
-import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
-
-@Beta
-public interface LinkageDeclaredStatement extends DeclaredStatement<Unqualified> {
- default @NonNull Collection<? extends ImportStatement> getImports() {
- return declaredSubstatements(ImportStatement.class);
- }
-
- default @NonNull Collection<? extends IncludeStatement> getIncludes() {
- return declaredSubstatements(IncludeStatement.class);
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2018 Pantheon Technoglogies, 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.model.api.stmt;
-
-import com.google.common.annotations.Beta;
-import java.util.Optional;
-
-/**
- * Common interface for statements which contain either a description/reference or a description/reference/status combo.
- */
-@Beta
-public interface MetaDeclaredStatement<T> extends DocumentedDeclaredStatement<T> {
- default Optional<OrganizationStatement> getOrganization() {
- return findFirstDeclaredSubstatement(OrganizationStatement.class);
- }
-
- default Optional<ContactStatement> getContact() {
- return findFirstDeclaredSubstatement(ContactStatement.class);
- }
-}
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.yangtools.yang.common.UnresolvedQName.Unqualified;
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
/**
* Declared representation of a {@code module} statement.
*/
-public interface ModuleStatement extends MetaDeclaredStatement<Unqualified>,
- LinkageDeclaredStatement, RevisionAwareDeclaredStatement, BodyDeclaredStatement {
+public non-sealed interface ModuleStatement extends RootDeclaredStatement {
@Override
default StatementDefinition statementDefinition() {
return YangStmtMapping.MODULE;
+++ /dev/null
-/*
- * Copyright (c) 2018 Pantheon Technoglogies, 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.model.api.stmt;
-
-import com.google.common.annotations.Beta;
-import java.util.Collection;
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.common.UnresolvedQName.Unqualified;
-import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
-
-@Beta
-public interface RevisionAwareDeclaredStatement extends DeclaredStatement<Unqualified> {
- default @NonNull Collection<? extends RevisionStatement> getRevisions() {
- return declaredSubstatements(RevisionStatement.class);
- }
-}
/*
- * Copyright (c) 2018 Pantheon Technologies, s.r.o. and others. All rights reserved.
+ * Copyright (c) 2022 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 com.google.common.annotations.Beta;
import java.util.Collection;
+import java.util.Optional;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.UnresolvedQName.Unqualified;
+/**
+ * Common interface capturing general layout of a top-level YANG declared statement -- either a {@link ModuleStatement}
+ * or a {@link SubmoduleStatement}.
+ */
@Beta
-public interface BodyDeclaredStatement extends NotificationStatementAwareDeclaredStatement<Unqualified>,
- DataDefinitionAwareDeclaredStatement.WithReusableDefinitions<Unqualified> {
+public sealed interface RootDeclaredStatement
+ extends DocumentedDeclaredStatement<Unqualified>, NotificationStatementAwareDeclaredStatement<Unqualified>,
+ DataDefinitionAwareDeclaredStatement.WithReusableDefinitions<Unqualified>
+ permits ModuleStatement, SubmoduleStatement {
+ default Optional<OrganizationStatement> getOrganization() {
+ return findFirstDeclaredSubstatement(OrganizationStatement.class);
+ }
+
+ default Optional<ContactStatement> getContact() {
+ return findFirstDeclaredSubstatement(ContactStatement.class);
+ }
+
+ default @NonNull Collection<? extends ImportStatement> getImports() {
+ return declaredSubstatements(ImportStatement.class);
+ }
+
+ default @NonNull Collection<? extends IncludeStatement> getIncludes() {
+ return declaredSubstatements(IncludeStatement.class);
+ }
+
+ default @NonNull Collection<? extends RevisionStatement> getRevisions() {
+ return declaredSubstatements(RevisionStatement.class);
+ }
+
default @NonNull Collection<? extends ExtensionStatement> getExtensions() {
return declaredSubstatements(ExtensionStatement.class);
}
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.yangtools.yang.common.UnresolvedQName.Unqualified;
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
/**
* Declared representation of a {@code submodule} statement.
*/
-public interface SubmoduleStatement extends MetaDeclaredStatement<Unqualified>, LinkageDeclaredStatement,
- RevisionAwareDeclaredStatement, BodyDeclaredStatement {
+public non-sealed interface SubmoduleStatement extends RootDeclaredStatement {
@Override
default StatementDefinition statementDefinition() {
return YangStmtMapping.SUBMODULE;
+++ /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.model.ri.stmt.impl.decl;
-
-import com.google.common.collect.ImmutableList;
-import org.opendaylight.yangtools.yang.common.UnresolvedQName.Unqualified;
-import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
-import org.opendaylight.yangtools.yang.model.api.stmt.BodyDeclaredStatement;
-import org.opendaylight.yangtools.yang.model.api.stmt.LinkageDeclaredStatement;
-import org.opendaylight.yangtools.yang.model.api.stmt.MetaDeclaredStatement;
-import org.opendaylight.yangtools.yang.model.api.stmt.RevisionAwareDeclaredStatement;
-import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredStatement.WithArgument.WithSubstatements;
-
-abstract class AbstractDeclaredEffectiveRootStatement<D extends DeclaredStatement<Unqualified>>
- extends WithSubstatements<Unqualified> implements LinkageDeclaredStatement,
- MetaDeclaredStatement<Unqualified>, RevisionAwareDeclaredStatement, BodyDeclaredStatement {
- protected AbstractDeclaredEffectiveRootStatement(final String rawArgument, final Unqualified argument,
- final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- super(rawArgument, argument, substatements);
- }
-}
import org.opendaylight.yangtools.yang.common.UnresolvedQName.Unqualified;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ModuleStatement;
+import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredStatement.WithArgument.WithSubstatements;
-public final class ModuleStatementImpl extends AbstractDeclaredEffectiveRootStatement<ModuleStatement>
- implements ModuleStatement {
+public final class ModuleStatementImpl extends WithSubstatements<Unqualified> implements ModuleStatement {
public ModuleStatementImpl(final String rawArgument, final Unqualified argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
super(rawArgument, argument, substatements);
import org.opendaylight.yangtools.yang.common.UnresolvedQName.Unqualified;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.SubmoduleStatement;
+import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredStatement.WithArgument.WithSubstatements;
-public final class SubmoduleStatementImpl extends AbstractDeclaredEffectiveRootStatement<SubmoduleStatement>
- implements SubmoduleStatement {
+public final class SubmoduleStatementImpl extends WithSubstatements<Unqualified> implements SubmoduleStatement {
public SubmoduleStatementImpl(final String rawArgument, final Unqualified argument,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
super(rawArgument, argument, substatements);