import com.google.common.annotations.Beta;
import java.util.Collection;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
/**
* Statement which can contain action statements.
*/
@Beta
-public interface ActionStatementAwareDeclaredStatement<A> extends DeclaredStatement<A>, ActionStatementContainer {
- @Override
- default Collection<? extends ActionStatement> getActions() {
+public interface ActionStatementAwareDeclaredStatement<A> extends DeclaredStatement<A> {
+ /**
+ * Return actions in this container. Since actions were introduced in RFC7950, hence RFC6020 semantics always
+ * returns an empty collection.
+ *
+ * @return collection of action statements
+ */
+ default @NonNull Collection<? extends ActionStatement> getActions() {
return declaredSubstatements(ActionStatement.class);
}
}
+++ /dev/null
-/*
- * Copyright (c) 2016 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.model.api.stmt;
-
-import com.google.common.annotations.Beta;
-import java.util.Collection;
-import org.eclipse.jdt.annotation.NonNull;
-
-/**
- * Statement which can contain action statements.
- */
-@Beta
-@Deprecated
-public interface ActionStatementContainer {
- /**
- * Return actions in this container. Since actions were introduced in RFC7950, hence RFC6020 semantics always
- * returns an empty collection.
- *
- * @return collection of action statements
- */
- @NonNull Collection<? extends ActionStatement> getActions();
-}
import com.google.common.annotations.Beta;
import java.util.Collection;
+import org.eclipse.jdt.annotation.NonNull;
@Beta
public interface BodyDeclaredStatement extends NotificationStatementAwareDeclaredStatement<String>,
- DataDefinitionAwareDeclaredStatement.WithReusableDefinitions<String>, BodyGroup {
- @Override
- default Collection<? extends ExtensionStatement> getExtensions() {
+ DataDefinitionAwareDeclaredStatement.WithReusableDefinitions<String> {
+ default @NonNull Collection<? extends ExtensionStatement> getExtensions() {
return declaredSubstatements(ExtensionStatement.class);
}
- @Override
- default Collection<? extends FeatureStatement> getFeatures() {
+ default @NonNull Collection<? extends FeatureStatement> getFeatures() {
return declaredSubstatements(FeatureStatement.class);
}
- @Override
- default Collection<? extends IdentityStatement> getIdentities() {
+ default @NonNull Collection<? extends IdentityStatement> getIdentities() {
return declaredSubstatements(IdentityStatement.class);
}
- @Override
- default Collection<? extends AugmentStatement> getAugments() {
+ default @NonNull Collection<? extends AugmentStatement> getAugments() {
return declaredSubstatements(AugmentStatement.class);
}
- @Override
- default Collection<? extends RpcStatement> getRpcs() {
+ default @NonNull Collection<? extends RpcStatement> getRpcs() {
return declaredSubstatements(RpcStatement.class);
}
- @Override
- default Collection<? extends DeviationStatement> getDeviations() {
+ default @NonNull Collection<? extends DeviationStatement> getDeviations() {
return declaredSubstatements(DeviationStatement.class);
}
}
+++ /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.model.api.stmt;
-
-import java.util.Collection;
-import org.eclipse.jdt.annotation.NonNull;
-
-@Rfc6020AbnfRule("body-stmts")
-@Deprecated
-public interface BodyGroup extends DataDefinitionContainer.WithReusableDefinitions, NotificationStatementContainer {
-
- @NonNull Collection<? extends ExtensionStatement> getExtensions();
-
- @NonNull Collection<? extends FeatureStatement> getFeatures();
-
- @NonNull Collection<? extends IdentityStatement> getIdentities();
-
- @NonNull Collection<? extends AugmentStatement> getAugments();
-
- @NonNull Collection<? extends RpcStatement> getRpcs();
-
- @NonNull Collection<? extends DeviationStatement> getDeviations();
-}
+++ /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.model.api.stmt;
-
-import org.eclipse.jdt.annotation.Nullable;
-
-@Deprecated
-public interface ConditionalDataDefinition extends ConditionalFeature {
-
- @Nullable WhenStatement getWhenStatement();
-}
+++ /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.model.api.stmt;
-
-import java.util.Collection;
-import org.eclipse.jdt.annotation.NonNull;
-
-@Rfc6020AbnfRule("*(if-feature-stmt)")
-@Deprecated
-public interface ConditionalFeature {
-
- /**
- * Return attached if-feature statements. Metamodel differs here between RFC6020 and RFC7950: some nodes will be
- * returning an empty collection in YANG 1.0 mode.
- *
- * @return collection of if-feature statements
- */
- @NonNull Collection<? extends IfFeatureStatement> getIfFeatures();
-}
import com.google.common.annotations.Beta;
import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
@Beta
-public interface ConfigStatementAwareDeclaredStatement<A> extends DeclaredStatement<A>, ConfigStatementContainer {
- @Override
- default ConfigStatement getConfig() {
- final Optional<ConfigStatement> opt = findFirstDeclaredSubstatement(ConfigStatement.class);
- return opt.isPresent() ? opt.get() : null;
+public interface ConfigStatementAwareDeclaredStatement<A> extends DeclaredStatement<A> {
+ /**
+ * Return a {@link ConfigStatement} child, if present.
+ *
+ * @return A {@link ConfigStatement}, or empty if none is present.
+ */
+ default @NonNull Optional<ConfigStatement> getConfig() {
+ return findFirstDeclaredSubstatement(ConfigStatement.class);
}
}
+++ /dev/null
-/*
- * Copyright (c) 2017 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 org.eclipse.jdt.annotation.Nullable;
-
-/**
- * Marker interface for statements which may contain a 'config' statement, as defined in RFC7950.
- *
- * @deprecated Use {@link ConfigStatementAwareDeclaredStatement} instead.
- */
-@Deprecated
-public interface ConfigStatementContainer {
- /**
- * Return a {@link ConfigStatement} child, if present.
- *
- * @return A {@link ConfigStatement}, or null if none is present.
- */
- @Nullable ConfigStatement getConfig();
-}
import com.google.common.annotations.Beta;
import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
/**
* Common interface for statements which contain either a description/reference or a description/reference/status combo.
*/
@Beta
-public interface ConstrainedDocumentedDeclaredStatement<T> extends DocumentedDeclaredStatement<T>,
- DocumentedConstraintGroup {
+public interface ConstrainedDocumentedDeclaredStatement<T> extends DocumentedDeclaredStatement<T> {
- @Override
- default ErrorAppTagStatement getErrorAppTagStatement() {
- final Optional<ErrorAppTagStatement> opt = findFirstDeclaredSubstatement(ErrorAppTagStatement.class);
- return opt.isPresent() ? opt.get() : null;
+ default @NonNull Optional<ErrorAppTagStatement> getErrorAppTagStatement() {
+ return findFirstDeclaredSubstatement(ErrorAppTagStatement.class);
}
- @Override
- default ErrorMessageStatement getErrorMessageStatement() {
- final Optional<ErrorMessageStatement> opt = findFirstDeclaredSubstatement(ErrorMessageStatement.class);
- return opt.isPresent() ? opt.get() : null;
+ default @NonNull Optional<ErrorMessageStatement> getErrorMessageStatement() {
+ return findFirstDeclaredSubstatement(ErrorMessageStatement.class);
}
interface WithStatus<T> extends ConstrainedDocumentedDeclaredStatement<T>,
import com.google.common.annotations.Beta;
import java.util.Collection;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
@Beta
-public interface DataDefinitionAwareDeclaredStatement<A> extends DeclaredStatement<A>, DataDefinitionContainer {
- @Override
- default Collection<? extends DataDefinitionStatement> getDataDefinitions() {
+public interface DataDefinitionAwareDeclaredStatement<A> extends DeclaredStatement<A> {
+ default @NonNull Collection<? extends DataDefinitionStatement> getDataDefinitions() {
return declaredSubstatements(DataDefinitionStatement.class);
}
- interface WithReusableDefinitions<A> extends DataDefinitionAwareDeclaredStatement<A>,
- DataDefinitionContainer.WithReusableDefinitions {
- @Override
- default Collection<? extends TypedefStatement> getTypedefs() {
+ interface WithReusableDefinitions<A> extends DataDefinitionAwareDeclaredStatement<A> {
+ default @NonNull Collection<? extends TypedefStatement> getTypedefs() {
return declaredSubstatements(TypedefStatement.class);
}
- @Override
- default Collection<? extends GroupingStatement> getGroupings() {
+ default @NonNull Collection<? extends GroupingStatement> getGroupings() {
return declaredSubstatements(GroupingStatement.class);
}
}
-
}
+++ /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.model.api.stmt;
-
-import java.util.Collection;
-import org.eclipse.jdt.annotation.NonNull;
-
-@Deprecated
-public interface DataDefinitionContainer {
-
- @NonNull Collection<? extends DataDefinitionStatement> getDataDefinitions();
-
- interface WithReusableDefinitions extends DataDefinitionContainer {
-
- @NonNull Collection<? extends TypedefStatement> getTypedefs();
-
- @NonNull Collection<? extends GroupingStatement> getGroupings();
- }
-}
import com.google.common.annotations.Beta;
import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
* Marker interface for statements which may contain a 'default' statement, as defined in RFC7950.
*/
@Beta
-public interface DefaultStatementAwareDeclaredStatement extends DeclaredStatement<QName>, DefaultStatementContainer {
- @Override
- default DefaultStatement getDefault() {
- final Optional<DefaultStatement> opt = findFirstDeclaredSubstatement(DefaultStatement.class);
- return opt.isPresent() ? opt.get() : null;
+public interface DefaultStatementAwareDeclaredStatement extends DeclaredStatement<QName> {
+ /**
+ * Return a {@link DefaultStatement} child, if present.
+ *
+ * @return A {@link DefaultStatement}, or empty if none is present.
+ */
+ default @NonNull Optional<DefaultStatement> getDefault() {
+ return findFirstDeclaredSubstatement(DefaultStatement.class);
}
}
+++ /dev/null
-/*
- * Copyright (c) 2017 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 org.eclipse.jdt.annotation.Nullable;
-
-/**
- * Marker interface for statements which may contain a 'default' statement, as defined in RFC7950.
- *
- * @deprecated Use {@link DefaultStatementAwareDeclaredStatement} instead.
- */
-@Deprecated
-public interface DefaultStatementContainer {
- /**
- * Return a {@link DefaultStatement} child, if present.
- *
- * @return A {@link DefaultStatement}, or null if none is present.
- */
- @Nullable DefaultStatement getDefault();
-}
+++ /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.model.api.stmt;
-
-import org.eclipse.jdt.annotation.Nullable;
-
-/**
- * Common interface for statements which contain either a description/reference or a description/reference/status combo.
- *
- * @deprecated Use {@link DocumentedDeclaredStatement} instead.
- */
-@Deprecated
-public interface DocumentationGroup {
- /**
- * Return description statement, if available.
- *
- * @return description statement
- */
- @Nullable DescriptionStatement getDescription();
-
- /**
- * Return description statement, if available.
- *
- * @return description statement
- */
- @Nullable ReferenceStatement getReference();
-
- interface WithStatus extends DocumentationGroup {
-
- @Nullable StatusStatement getStatus();
- }
-}
+++ /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.model.api.stmt;
-
-import org.eclipse.jdt.annotation.Nullable;
-
-/**
- * Documented constraints.
- *
- * @deprecated Use {@link ConstrainedDocumentedDeclaredStatement} instead.
- */
-@Deprecated
-public interface DocumentedConstraintGroup extends DocumentationGroup {
-
- @Nullable ErrorAppTagStatement getErrorAppTagStatement();
-
- @Nullable ErrorMessageStatement getErrorMessageStatement();
-}
import com.google.common.annotations.Beta;
import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
/**
* Common interface for statements which contain either a description/reference or a description/reference/status combo.
*/
@Beta
-public interface DocumentedDeclaredStatement<T> extends DeclaredStatement<T>, DocumentationGroup {
- @Override
- default DescriptionStatement getDescription() {
- final Optional<DescriptionStatement> opt = findFirstDeclaredSubstatement(DescriptionStatement.class);
- return opt.isPresent() ? opt.get() : null;
+public interface DocumentedDeclaredStatement<T> extends DeclaredStatement<T> {
+ /**
+ * Return description statement, if available.
+ *
+ * @return description statement
+ */
+ default @NonNull Optional<DescriptionStatement> getDescription() {
+ return findFirstDeclaredSubstatement(DescriptionStatement.class);
}
- @Override
- default ReferenceStatement getReference() {
- final Optional<ReferenceStatement> opt = findFirstDeclaredSubstatement(ReferenceStatement.class);
- return opt.isPresent() ? opt.get() : null;
+ /**
+ * Return description statement, if available.
+ *
+ * @return description statement
+ */
+ default @NonNull Optional<ReferenceStatement> getReference() {
+ return findFirstDeclaredSubstatement(ReferenceStatement.class);
}
- interface WithStatus<T> extends DocumentedDeclaredStatement<T>, DocumentationGroup.WithStatus {
- @Override
- default StatusStatement getStatus() {
- final Optional<StatusStatement> opt = findFirstDeclaredSubstatement(StatusStatement.class);
- return opt.isPresent() ? opt.get() : null;
+ interface WithStatus<T> extends DocumentedDeclaredStatement<T> {
+ default @NonNull Optional<StatusStatement> getStatus() {
+ return findFirstDeclaredSubstatement(StatusStatement.class);
}
}
}
import com.google.common.annotations.Beta;
import java.util.Collection;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
@Beta
-public interface IfFeatureAwareDeclaredStatement<A> extends DeclaredStatement<A>, ConditionalFeature {
- @Override
- default Collection<? extends IfFeatureStatement> getIfFeatures() {
+public interface IfFeatureAwareDeclaredStatement<A> extends DeclaredStatement<A> {
+ /**
+ * Return attached if-feature statements. Metamodel differs here between RFC6020 and RFC7950: some nodes will be
+ * returning an empty collection in YANG 1.0 mode.
+ *
+ * @return collection of if-feature statements
+ */
+ default @NonNull Collection<? extends IfFeatureStatement> getIfFeatures() {
return declaredSubstatements(IfFeatureStatement.class);
}
}
import com.google.common.annotations.Beta;
import java.util.Collection;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
@Beta
-public interface LinkageDeclaredStatement extends DeclaredStatement<String>, LinkageGroup {
- @Override
- default Collection<? extends ImportStatement> getImports() {
+public interface LinkageDeclaredStatement extends DeclaredStatement<String> {
+ default @NonNull Collection<? extends ImportStatement> getImports() {
return declaredSubstatements(ImportStatement.class);
}
- @Override
- default Collection<? extends IncludeStatement> getIncludes() {
+ default @NonNull Collection<? extends IncludeStatement> getIncludes() {
return declaredSubstatements(IncludeStatement.class);
}
}
+++ /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.model.api.stmt;
-
-import java.util.Collection;
-import org.eclipse.jdt.annotation.NonNull;
-
-@Rfc6020AbnfRule("linkage-stms")
-@Deprecated
-public interface LinkageGroup {
-
- @NonNull Collection<? extends ImportStatement> getImports();
-
- @NonNull Collection<? extends IncludeStatement> getIncludes();
-}
import com.google.common.annotations.Beta;
import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
/**
* Marker interface for statements which may contain a 'mandatory' statement, as defined in RFC7950.
*/
@Beta
-public interface MandatoryStatementAwareDeclaredStatement<T> extends DeclaredStatement<T>,
- MandatoryStatementContainer {
+public interface MandatoryStatementAwareDeclaredStatement<T> extends DeclaredStatement<T> {
/**
* Return a {@link MandatoryStatement} child, if present.
*
- * @return A {@link MandatoryStatement}, or null if none is present.
+ * @return A {@link MandatoryStatement}, or empty if none is present.
*/
- @Override
- default MandatoryStatement getMandatory() {
- final Optional<MandatoryStatement> opt = findFirstDeclaredSubstatement(MandatoryStatement.class);
- return opt.isPresent() ? opt.get() : null;
+ default @NonNull Optional<MandatoryStatement> getMandatory() {
+ return findFirstDeclaredSubstatement(MandatoryStatement.class);
}
}
+++ /dev/null
-/*
- * Copyright (c) 2017 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 org.eclipse.jdt.annotation.Nullable;
-
-/**
- * Marker interface for statements which may contain a 'mandatory' statement, as defined in RFC7950.
- *
- * @deprecated Use {@link MandatoryStatementAwareDeclaredStatement} instead.
- */
-@Deprecated
-public interface MandatoryStatementContainer {
- /**
- * Return a {@link MandatoryStatement} child, if present.
- *
- * @return A {@link MandatoryStatement}, or null if none is present.
- */
- @Nullable MandatoryStatement getMandatory();
-}
* Common interface for statements which contain either a description/reference or a description/reference/status combo.
*/
@Beta
-public interface MetaDeclaredStatement<T> extends DocumentedDeclaredStatement<T>, MetaGroup {
- @Override
- default OrganizationStatement getOrganization() {
- final Optional<OrganizationStatement> opt = findFirstDeclaredSubstatement(OrganizationStatement.class);
- return opt.isPresent() ? opt.get() : null;
+public interface MetaDeclaredStatement<T> extends DocumentedDeclaredStatement<T> {
+ default Optional<OrganizationStatement> getOrganization() {
+ return findFirstDeclaredSubstatement(OrganizationStatement.class);
}
- @Override
- default ContactStatement getContact() {
- final Optional<ContactStatement> opt = findFirstDeclaredSubstatement(ContactStatement.class);
- return opt.isPresent() ? opt.get() : null;
+ default Optional<ContactStatement> getContact() {
+ return findFirstDeclaredSubstatement(ContactStatement.class);
}
}
+++ /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.model.api.stmt;
-
-import org.eclipse.jdt.annotation.Nullable;
-
-@Rfc6020AbnfRule("meta-stmts")
-@Deprecated
-public interface MetaGroup extends DocumentationGroup {
-
- @Nullable OrganizationStatement getOrganization();
-
- @Nullable ContactStatement getContact();
-}
import com.google.common.annotations.Beta;
import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
@Beta
-public interface MultipleElementsDeclaredStatement extends DataDefinitionStatement, MultipleElementsGroup {
- @Override
- default MinElementsStatement getMinElements() {
- final Optional<MinElementsStatement> opt = findFirstDeclaredSubstatement(MinElementsStatement.class);
- return opt.isPresent() ? opt.get() : null;
+public interface MultipleElementsDeclaredStatement extends DataDefinitionStatement {
+ default @NonNull Optional<MinElementsStatement> getMinElements() {
+ return findFirstDeclaredSubstatement(MinElementsStatement.class);
}
- @Override
- default MaxElementsStatement getMaxElements() {
- final Optional<MaxElementsStatement> opt = findFirstDeclaredSubstatement(MaxElementsStatement.class);
- return opt.isPresent() ? opt.get() : null;
+ default @NonNull Optional<MaxElementsStatement> getMaxElements() {
+ return findFirstDeclaredSubstatement(MaxElementsStatement.class);
}
- @Override
- default OrderedByStatement getOrderedBy() {
- final Optional<OrderedByStatement> opt = findFirstDeclaredSubstatement(OrderedByStatement.class);
- return opt.isPresent() ? opt.get() : null;
+ default @NonNull Optional<OrderedByStatement> getOrderedBy() {
+ return findFirstDeclaredSubstatement(OrderedByStatement.class);
}
}
+++ /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.model.api.stmt;
-
-import org.eclipse.jdt.annotation.Nullable;
-
-/**
- * Common statements of collection-like statements.
- *
- * @deprecated Use {@link MultipleElementsDeclaredStatement} instead.
- */
-@Deprecated
-public interface MultipleElementsGroup {
-
- @Nullable MinElementsStatement getMinElements();
-
- @Nullable MaxElementsStatement getMaxElements();
-
- @Nullable OrderedByStatement getOrderedBy();
-}
import com.google.common.annotations.Beta;
import java.util.Collection;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
@Beta
-public interface MustStatementAwareDeclaredStatement<A> extends DeclaredStatement<A>,
- MustStatementContainer {
- @Override
- default Collection<? extends MustStatement> getMusts() {
+public interface MustStatementAwareDeclaredStatement<A> extends DeclaredStatement<A> {
+ /**
+ * Return collection of {@link MustStatement}. For RFC6020, this method returns an empty collection for statements
+ * which do not allow for must statement children.
+ *
+ * @return collection of must statements
+ */
+ default @NonNull Collection<? extends MustStatement> getMustStatements() {
return declaredSubstatements(MustStatement.class);
}
}
+++ /dev/null
-/*
- * Copyright (c) 2017 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 java.util.Collection;
-import org.eclipse.jdt.annotation.NonNull;
-
-/**
- * Marker interface for statements which may contain a 'must' statement, as defined in RFC7950. There is a significant
- * difference RFC6020 (YANG 1) and RFC7590 (YANG 1.1) in which statements sport this feature.
- *
- * @deprecated Use {@link MustStatementAwareDeclaredStatement} instead.
- */
-@Deprecated
-public interface MustStatementContainer {
- /**
- * Return collection of {@link MustStatement}. For RFC6020, this method returns an empty collection for statements
- * which do not allow for must statement children.
- *
- * @return collection of must statements
- */
- @NonNull Collection<? extends MustStatement> getMusts();
-}
import com.google.common.annotations.Beta;
import java.util.Collection;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
@Beta
-public interface NotificationStatementAwareDeclaredStatement<A> extends DeclaredStatement<A>,
- NotificationStatementContainer {
- @Override
- default Collection<? extends NotificationStatement> getNotifications() {
+public interface NotificationStatementAwareDeclaredStatement<A> extends DeclaredStatement<A> {
+ /**
+ * Return collection of {@link NotificationStatement}. For RFC6020, this method returns an empty collection for
+ * statements which do not allow for must statement children.
+ *
+ * @return collection of notification statements
+ */
+ default @NonNull Collection<? extends NotificationStatement> getNotifications() {
return declaredSubstatements(NotificationStatement.class);
}
}
+++ /dev/null
-/*
- * Copyright (c) 2016 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.model.api.stmt;
-
-import java.util.Collection;
-import org.eclipse.jdt.annotation.NonNull;
-
-/**
- * Marker interface for statements which may contain a 'notification' statement, as defined in RFC7950. There is
- * a significant difference RFC6020 (YANG 1) and RFC7590 (YANG 1.1) in which statements sport this feature.
- *
- * @deprecated Use {@link NotificationStatementAwareDeclaredStatement} instead.
- */
-@Deprecated
-public interface NotificationStatementContainer {
- /**
- * Return collection of {@link NotificationStatement}. For RFC6020, this method returns an empty collection for
- * statements which do not allow for must statement children.
- *
- * @return collection of notification statements
- */
- @NonNull Collection<? extends NotificationStatement> getNotifications();
-}
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.QName;
/**
* Common interface for action and rpc statements.
*/
@Beta
-public interface OperationDeclaredStatement extends DocumentedDeclaredStatement.WithStatus<QName>, OperationGroup,
+public interface OperationDeclaredStatement extends DocumentedDeclaredStatement.WithStatus<QName>,
IfFeatureAwareDeclaredStatement<QName> {
- @Override
- default QName getName() {
+ default @NonNull QName getName() {
// FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here
return verifyNotNull(argument());
}
- @Override
- default InputStatement getInput() {
- final Optional<InputStatement> opt = findFirstDeclaredSubstatement(InputStatement.class);
- return opt.isPresent() ? opt.get() : null;
+ default @NonNull Optional<InputStatement> getInput() {
+ return findFirstDeclaredSubstatement(InputStatement.class);
}
- @Override
- default OutputStatement getOutput() {
- final Optional<OutputStatement> opt = findFirstDeclaredSubstatement(OutputStatement.class);
- return opt.isPresent() ? opt.get() : null;
+ default @NonNull Optional<OutputStatement> getOutput() {
+ return findFirstDeclaredSubstatement(OutputStatement.class);
}
- @Override
- default Collection<? extends TypedefStatement> getTypedefs() {
+ default @NonNull Collection<? extends TypedefStatement> getTypedefs() {
return declaredSubstatements(TypedefStatement.class);
}
- @Override
- default Collection<? extends GroupingStatement> getGroupings() {
+ default @NonNull Collection<? extends GroupingStatement> getGroupings() {
return declaredSubstatements(GroupingStatement.class);
}
}
+++ /dev/null
-/*
- * Copyright (c) 2016 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.model.api.stmt;
-
-import com.google.common.annotations.Beta;
-import java.util.Collection;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.yangtools.yang.common.QName;
-
-/**
- * Common interface for action and rpc statements.
- *
- * @deprecated Use {@link OperationDeclaredStatement} instead.
- */
-@Deprecated
-@Beta
-public interface OperationGroup extends DocumentationGroup.WithStatus, ConditionalFeature {
-
- @NonNull QName getName();
-
- @NonNull Collection<? extends TypedefStatement> getTypedefs();
-
- @NonNull Collection<? extends GroupingStatement> getGroupings();
-
- @Nullable InputStatement getInput();
-
- @Nullable OutputStatement getOutput();
-}
import com.google.common.annotations.Beta;
import java.util.Collection;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
@Beta
-public interface RevisionAwareDeclaredStatement extends DeclaredStatement<String>, RevisionGroup {
- @Override
- default Collection<? extends RevisionStatement> getRevisions() {
+public interface RevisionAwareDeclaredStatement extends DeclaredStatement<String> {
+ default @NonNull Collection<? extends RevisionStatement> getRevisions() {
return declaredSubstatements(RevisionStatement.class);
}
}
+++ /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.model.api.stmt;
-
-import java.util.Collection;
-import org.eclipse.jdt.annotation.NonNull;
-
-@Rfc6020AbnfRule("revision-stmts")
-@Deprecated
-public interface RevisionGroup {
-
- @NonNull Collection<? extends RevisionStatement> getRevisions();
-}
import com.google.common.annotations.Beta;
import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
@Beta
-public interface TypeAwareDeclaredStatement extends DeclaredStatement<QName>, TypeGroup {
- @Override
- default TypeStatement getType() {
+public interface TypeAwareDeclaredStatement extends DeclaredStatement<QName> {
+ default @NonNull TypeStatement getType() {
return findFirstDeclaredSubstatement(TypeStatement.class).get();
}
- @Override
- default UnitsStatement getUnits() {
- final Optional<UnitsStatement> opt = findFirstDeclaredSubstatement(UnitsStatement.class);
- return opt.isPresent() ? opt.get() : null;
+ default @NonNull Optional<UnitsStatement> getUnits() {
+ return findFirstDeclaredSubstatement(UnitsStatement.class);
}
}
+++ /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.model.api.stmt;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-
-@Deprecated
-public interface TypeGroup {
-
- @NonNull TypeStatement getType();
-
- @Nullable UnitsStatement getUnits();
-}
import com.google.common.annotations.Beta;
import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
@Beta
-public interface WhenStatementAwareDeclaredStatement<A> extends IfFeatureAwareDeclaredStatement<A>,
- ConditionalDataDefinition {
- @Override
- default WhenStatement getWhenStatement() {
- final Optional<WhenStatement> opt = findFirstDeclaredSubstatement(WhenStatement.class);
- return opt.isPresent() ? opt.get() : null;
+public interface WhenStatementAwareDeclaredStatement<A> extends IfFeatureAwareDeclaredStatement<A> {
+ default @NonNull Optional<WhenStatement> getWhenStatement() {
+ return findFirstDeclaredSubstatement(WhenStatement.class);
}
}
import org.opendaylight.yangtools.yang.model.api.stmt.DataDefinitionStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.DefaultStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
-import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
-import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ExtensionStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.FeatureStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.GroupingStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ImportStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.IncludeStatement;
-import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.ModuleStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.MustStatement;
final QName name = anyxmlStatement.getName();
assertNotNull(name);
- final WhenStatement whenStatement = anyxmlStatement.getWhenStatement();
- assertNotNull(whenStatement);
+ final WhenStatement whenStatement = anyxmlStatement.getWhenStatement().get();
final RevisionAwareXPath whenRevisionAwareXPath = whenStatement.getCondition();
assertNotNull(whenRevisionAwareXPath);
- final DescriptionStatement whenStatementDescription = whenStatement.getDescription();
- assertNotNull(whenStatementDescription);
- final ReferenceStatement whenStatementReference = whenStatement.getReference();
- assertNotNull(whenStatementReference);
+ final DescriptionStatement whenStatementDescription = whenStatement.getDescription().get();
+ assertTrue(whenStatement.getReference().isPresent());
final Collection<? extends IfFeatureStatement> ifFeatureStatements = anyxmlStatement.getIfFeatures();
assertNotNull(ifFeatureStatements);
final Predicate<Set<QName>> ifFeaturePredicate = ifFeatureStatements.iterator().next().getIfFeaturePredicate();
assertNotNull(ifFeaturePredicate);
- final Collection<? extends MustStatement> mustStatements = anyxmlStatement.getMusts();
+ final Collection<? extends MustStatement> mustStatements = anyxmlStatement.getMustStatements();
assertNotNull(mustStatements);
assertEquals(1, mustStatements.size());
final MustStatement mustStatement = mustStatements.iterator().next();
final RevisionAwareXPath mustRevisionAwareXPath = mustStatement.getCondition();
assertNotNull(mustRevisionAwareXPath);
- final ErrorAppTagStatement errorAppTagStatement = mustStatement.getErrorAppTagStatement();
- assertNotNull(errorAppTagStatement);
- final ErrorMessageStatement errorMessageStatement = mustStatement.getErrorMessageStatement();
- assertNotNull(errorMessageStatement);
- final DescriptionStatement mustStatementDescription = mustStatement.getDescription();
- assertNotNull(mustStatementDescription);
- final ReferenceStatement mustStatementReference = mustStatement.getReference();
- assertNotNull(mustStatementReference);
-
- final ConfigStatement configStatement = anyxmlStatement.getConfig();
- assertNotNull(configStatement);
+ assertTrue(mustStatement.getErrorAppTagStatement().isPresent());
+ assertTrue(mustStatement.getErrorMessageStatement().isPresent());
+ assertTrue(mustStatement.getDescription().isPresent());
+ assertTrue(mustStatement.getReference().isPresent());
+
+ final ConfigStatement configStatement = anyxmlStatement.getConfig().get();
assertFalse(configStatement.getValue());
- final StatusStatement statusStatement = anyxmlStatement.getStatus();
- assertNotNull(statusStatement);
+ final StatusStatement statusStatement = anyxmlStatement.getStatus().get();
final Status status = statusStatement.getValue();
assertNotNull(status);
- final DescriptionStatement descriptionStatement = anyxmlStatement.getDescription();
- assertNotNull(descriptionStatement);
+ final DescriptionStatement descriptionStatement = anyxmlStatement.getDescription().get();
assertEquals("anyxml description", descriptionStatement.getText());
- final ReferenceStatement referenceStatement = anyxmlStatement.getReference();
- assertNotNull(referenceStatement);
+ final ReferenceStatement referenceStatement = anyxmlStatement.getReference().get();
assertEquals("anyxml reference", referenceStatement.getText());
- final MandatoryStatement mandatoryStatement = anyxmlStatement.getMandatory();
- assertNotNull(mandatoryStatement);
+ assertTrue(anyxmlStatement.getMandatory().isPresent());
}
@Test
final QName name = choiceStatement.getName();
assertNotNull(name);
- final DefaultStatement defaultStatement = choiceStatement.getDefault();
- assertNotNull(defaultStatement);
+ final DefaultStatement defaultStatement = choiceStatement.getDefault().get();
assertEquals("case-two", defaultStatement.getValue());
- final ConfigStatement configStatement = choiceStatement.getConfig();
- assertNotNull(configStatement);
-
- final MandatoryStatement mandatoryStatement = choiceStatement.getMandatory();
- assertNotNull(mandatoryStatement);
+ assertTrue(choiceStatement.getConfig().isPresent());
+ assertTrue(choiceStatement.getMandatory().isPresent());
final Collection<? extends CaseStatement> caseStatements = choiceStatement.getCases();
assertNotNull(caseStatements);
final CaseStatement caseStatement = caseStatements.iterator().next();
final QName caseStatementName = caseStatement.getName();
assertNotNull(caseStatementName);
- final WhenStatement caseStatementWhen = caseStatement.getWhenStatement();
- assertNotNull(caseStatementWhen);
+ final WhenStatement caseStatementWhen = caseStatement.getWhenStatement().get();
final Collection<? extends IfFeatureStatement> caseStatementIfFeatures = caseStatement.getIfFeatures();
assertNotNull(caseStatementIfFeatures);
assertEquals(1, caseStatementIfFeatures.size());
caseStatement.getDataDefinitions();
assertNotNull(caseStatementDataDefinitions);
assertEquals(1, caseStatementDataDefinitions.size());
- final StatusStatement caseStatementStatus = caseStatement.getStatus();
- assertNotNull(caseStatementStatus);
- final DescriptionStatement caseStatementDescription = caseStatement.getDescription();
- assertNotNull(caseStatementDescription);
- final ReferenceStatement caseStatementReference = caseStatement.getReference();
- assertNotNull(caseStatementReference);
+ assertTrue(caseStatement.getStatus().isPresent());
+ assertTrue(caseStatement.getDescription().isPresent());
+ assertTrue(caseStatement.getReference().isPresent());
- final WhenStatement whenStatement = choiceStatement.getWhenStatement();
- assertNotNull(whenStatement);
+ final WhenStatement whenStatement = choiceStatement.getWhenStatement().get();
final Collection<? extends IfFeatureStatement> ifFeatureStatements = choiceStatement.getIfFeatures();
assertNotNull(ifFeatureStatements);
assertEquals(1, ifFeatureStatements.size());
- final StatusStatement statusStatement = choiceStatement.getStatus();
- assertNotNull(statusStatement);
-
- final DescriptionStatement descriptionStatement = choiceStatement.getDescription();
- assertNotNull(descriptionStatement);
-
- final ReferenceStatement referenceStatement = choiceStatement.getReference();
- assertNotNull(referenceStatement);
+ assertTrue(choiceStatement.getStatus().isPresent());
+ assertTrue(choiceStatement.getDescription().isPresent());
+ assertTrue(choiceStatement.getReference().isPresent());
}
@Test
assertEquals("imdt", importStatement.getPrefix().getValue());
assertEquals(revision, importStatement.getRevisionDate().getDate());
- assertEquals("test description", moduleStatement.getDescription().getText());
- assertEquals("test reference", moduleStatement.getReference().getText());
- assertEquals("test organization", moduleStatement.getOrganization().getText());
- assertEquals("test contact", moduleStatement.getContact().getText());
+ assertEquals("test description", moduleStatement.getDescription().get().getText());
+ assertEquals("test reference", moduleStatement.getReference().get().getText());
+ assertEquals("test organization", moduleStatement.getOrganization().get().getText());
+ assertEquals("test contact", moduleStatement.getContact().get().getText());
assertEquals(1, moduleStatement.getRevisions().size());
final RevisionStatement revisionStatement = moduleStatement.getRevisions().iterator().next();
assertEquals(revision, revisionStatement.getDate());
- assertEquals("test description", revisionStatement.getDescription().getText());
- assertEquals("test reference", revisionStatement.getReference().getText());
+ assertEquals("test description", revisionStatement.getDescription().get().getText());
+ assertEquals("test reference", revisionStatement.getReference().get().getText());
assertEquals(1, moduleStatement.getExtensions().size());
final ExtensionStatement extensionStatement = moduleStatement.getExtensions().iterator().next();
- assertEquals(Status.CURRENT, extensionStatement.getStatus().getValue());
- assertEquals("test description", extensionStatement.getDescription().getText());
- assertEquals("test reference", extensionStatement.getReference().getText());
+ assertEquals(Status.CURRENT, extensionStatement.getStatus().get().getValue());
+ assertEquals("test description", extensionStatement.getDescription().get().getText());
+ assertEquals("test reference", extensionStatement.getReference().get().getText());
final ArgumentStatement argumentStatement = extensionStatement.getArgument();
assertEquals("ext-argument", argumentStatement.getName().getLocalName());
assertTrue(argumentStatement.getYinElement().getValue());
assertEquals(1, moduleStatement.getFeatures().size());
final FeatureStatement featureStatement = moduleStatement.getFeatures().iterator().next();
- assertEquals(Status.CURRENT, featureStatement.getStatus().getValue());
- assertEquals("test description", featureStatement.getDescription().getText());
- assertEquals("test reference", featureStatement.getReference().getText());
+ assertEquals(Status.CURRENT, featureStatement.getStatus().get().getValue());
+ assertEquals("test description", featureStatement.getDescription().get().getText());
+ assertEquals("test reference", featureStatement.getReference().get().getText());
assertEquals("test-feature", featureStatement.getName().getLocalName());
assertEquals(1, featureStatement.getIfFeatures().size());
}
assertEquals("test-base-id", identityStatement.getBases().iterator().next().getName().getLocalName());
- assertEquals(Status.CURRENT, identityStatement.getStatus().getValue());
- assertEquals("test description", identityStatement.getDescription().getText());
- assertEquals("test reference", identityStatement.getReference().getText());
+ assertEquals(Status.CURRENT, identityStatement.getStatus().get().getValue());
+ assertEquals("test description", identityStatement.getDescription().get().getText());
+ assertEquals("test reference", identityStatement.getReference().get().getText());
assertEquals("test-id", identityStatement.getName().getLocalName());
assertEquals(1, moduleStatement.getTypedefs().size());
final TypedefStatement typedefStatement = moduleStatement.getTypedefs().iterator().next();
- assertEquals(Status.CURRENT, typedefStatement.getStatus().getValue());
- assertEquals("test description", typedefStatement.getDescription().getText());
- assertEquals("test reference", typedefStatement.getReference().getText());
+ assertEquals(Status.CURRENT, typedefStatement.getStatus().get().getValue());
+ assertEquals("test description", typedefStatement.getDescription().get().getText());
+ assertEquals("test reference", typedefStatement.getReference().get().getText());
assertEquals("test-typedef", typedefStatement.getName().getLocalName());
assertEquals("int32", typedefStatement.getType().getName());
- assertEquals("meter", typedefStatement.getUnits().getName());
+ assertEquals("meter", typedefStatement.getUnits().get().getName());
}
@Test
final QName name = containerStatement.getName();
assertNotNull(name);
- final WhenStatement containerStatementWhen = containerStatement.getWhenStatement();
- assertNotNull(containerStatementWhen);
+ final WhenStatement containerStatementWhen = containerStatement.getWhenStatement().get();
final Collection<? extends IfFeatureStatement> containerStatementIfFeatures =
containerStatement.getIfFeatures();
assertNotNull(containerStatementIfFeatures);
assertEquals(1, containerStatementIfFeatures.size());
- final Collection<? extends MustStatement> containerStatementMusts = containerStatement.getMusts();
+ final Collection<? extends MustStatement> containerStatementMusts = containerStatement.getMustStatements();
assertNotNull(containerStatementMusts);
assertEquals(1, containerStatementMusts.size());
assertNotNull(containerStatementPresence);
assertNotNull(containerStatementPresence.getValue());
- final ConfigStatement containerStatementConfig = containerStatement.getConfig();
- assertNotNull(containerStatementConfig);
-
- final StatusStatement containerStatementStatus = containerStatement.getStatus();
- assertNotNull(containerStatementStatus);
-
- final DescriptionStatement containerStatementDescription = containerStatement.getDescription();
- assertNotNull(containerStatementDescription);
-
- final ReferenceStatement containerStatementReference = containerStatement.getReference();
- assertNotNull(containerStatementReference);
+ assertTrue(containerStatement.getConfig().isPresent());
+ assertTrue(containerStatement.getStatus().isPresent());
+ assertTrue(containerStatement.getDescription().isPresent());
+ assertTrue(containerStatement.getReference().isPresent());
final Collection<? extends TypedefStatement> containerStatementTypedefs = containerStatement.getTypedefs();
assertNotNull(containerStatementTypedefs);