From 4b699eee4622fe4349bf4e1aeb67567b3e9926b0 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 3 Feb 2021 20:49:08 +0100 Subject: [PATCH] Use Empty instead of Void for argument @NonNull is an extremely important property. Using yang.common.Empty instead of java.lang.Void allows us to ensure ModelStatement.argument() is non-null. This renders a number of utility methods completely superfluous, and we end up removing them. JIRA: YANGTOOLS-1220 Change-Id: I86c80dfd32d3a5f377effc62c00ad12c8ca61fd6 Signed-off-by: Robert Varga --- .../src/main/java/module-info.java | 1 + ...enConfigHashedValueEffectiveStatement.java | 3 +- .../api/OpenConfigHashedValueStatement.java | 3 +- .../AbstractHashedValueStatementSupport.java | 15 +-- .../src/main/java/module-info.java | 1 + ...erElementAttributesEffectiveStatement.java | 3 +- .../GetFilterElementAttributesStatement.java | 3 +- ...lterElementAttributesStatementSupport.java | 17 +-- .../src/main/java/module-info.java | 1 + .../api/DefaultDenyAllEffectiveStatement.java | 3 +- .../model/api/DefaultDenyAllStatement.java | 3 +- .../DefaultDenyWriteEffectiveStatement.java | 3 +- .../model/api/DefaultDenyWriteStatement.java | 3 +- .../DefaultDenyAllStatementSupport.java | 15 +-- .../DefaultDenyWriteStatementSupport.java | 16 +-- .../model/api/meta/EffectiveStatement.java | 3 +- .../yang/model/api/meta/ModelStatement.java | 7 +- .../model/api/stmt/ArgumentStatement.java | 8 -- .../yang/model/api/stmt/AugmentStatement.java | 8 +- .../yang/model/api/stmt/BaseStatement.java | 8 -- .../model/api/stmt/BelongsToStatement.java | 7 -- .../yang/model/api/stmt/BitStatement.java | 8 -- .../yang/model/api/stmt/CaseStatement.java | 8 -- .../yang/model/api/stmt/ContactStatement.java | 8 -- .../api/stmt/DataDefinitionStatement.java | 13 +-- .../yang/model/api/stmt/DefaultStatement.java | 8 -- .../model/api/stmt/DescriptionStatement.java | 8 -- .../yang/model/api/stmt/DeviateStatement.java | 8 -- .../model/api/stmt/DeviationStatement.java | 8 +- .../yang/model/api/stmt/EnumStatement.java | 8 -- .../model/api/stmt/ErrorAppTagStatement.java | 8 -- .../model/api/stmt/ErrorMessageStatement.java | 8 -- .../yang/model/api/stmt/FeatureStatement.java | 8 -- .../model/api/stmt/GroupingStatement.java | 8 -- .../model/api/stmt/IdentityStatement.java | 7 -- .../model/api/stmt/IfFeatureStatement.java | 6 +- .../yang/model/api/stmt/ImportStatement.java | 7 -- .../yang/model/api/stmt/IncludeStatement.java | 8 -- .../model/api/stmt/MandatoryStatement.java | 8 +- .../model/api/stmt/MaxElementsStatement.java | 8 -- .../model/api/stmt/MinElementsStatement.java | 8 -- .../model/api/stmt/ModifierStatement.java | 8 -- .../yang/model/api/stmt/ModuleStatement.java | 8 -- .../yang/model/api/stmt/MustStatement.java | 8 -- .../model/api/stmt/NamespaceStatement.java | 8 -- .../stmt/NamespacedEffectiveStatement.java | 4 +- .../model/api/stmt/NotificationStatement.java | 8 -- .../api/stmt/OperationDeclaredStatement.java | 7 -- .../model/api/stmt/OrderedByStatement.java | 8 -- .../model/api/stmt/OrganizationStatement.java | 8 -- .../yang/model/api/stmt/PathStatement.java | 8 -- .../model/api/stmt/PositionStatement.java | 7 -- .../yang/model/api/stmt/PrefixStatement.java | 8 -- .../model/api/stmt/PresenceStatement.java | 8 -- .../model/api/stmt/ReferenceStatement.java | 8 -- .../yang/model/api/stmt/RefineStatement.java | 7 -- .../model/api/stmt/RevisionDateStatement.java | 4 - .../model/api/stmt/RevisionStatement.java | 8 -- .../yang/model/api/stmt/StatusStatement.java | 8 -- .../model/api/stmt/SubmoduleStatement.java | 7 -- .../yang/model/api/stmt/TypeStatement.java | 7 -- .../yang/model/api/stmt/TypedefStatement.java | 8 -- .../yang/model/api/stmt/UniqueStatement.java | 9 -- .../yang/model/api/stmt/UnitsStatement.java | 8 -- .../yang/model/api/stmt/UnknownStatement.java | 8 +- .../stmt/UnrecognizedEffectiveStatement.java | 2 +- .../model/api/stmt/UnrecognizedStatement.java | 7 +- .../yang/model/api/stmt/WhenStatement.java | 8 -- .../model/api/stmt/YangVersionStatement.java | 8 -- .../model/api/stmt/YinElementStatement.java | 2 +- .../stmt/AbstractDeclaredStatement.java | 37 +++++-- .../UnrecognizedEffectiveStatementImpl.java | 4 +- .../extension/UnrecognizedStatementImpl.java | 11 +- .../UnrecognizedStatementSupport.java | 12 +- .../import_/ImportEffectiveStatementImpl.java | 2 +- .../stmt/key/AbstractKeyStatement.java | 2 +- .../AbstractOrderedByStatement.java | 2 +- .../stmt/status/AbstractStatusStatement.java | 2 +- .../yang/stmt/DeclaredStatementsTest.java | 103 +++++++++--------- ...ava => AbstractEmptyStatementSupport.java} | 14 ++- 80 files changed, 183 insertions(+), 505 deletions(-) rename yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/{AbstractVoidStatementSupport.java => AbstractEmptyStatementSupport.java} (53%) diff --git a/yang/openconfig-model-api/src/main/java/module-info.java b/yang/openconfig-model-api/src/main/java/module-info.java index 7aaf20f1a2..f930e8e4ee 100644 --- a/yang/openconfig-model-api/src/main/java/module-info.java +++ b/yang/openconfig-model-api/src/main/java/module-info.java @@ -9,6 +9,7 @@ module org.opendaylight.yangtools.openconfig.model.api { exports org.opendaylight.yangtools.openconfig.model.api; requires transitive org.opendaylight.yangtools.yang.model.api; + requires org.opendaylight.yangtools.yang.common; // Annotations requires static com.github.spotbugs.annotations; diff --git a/yang/openconfig-model-api/src/main/java/org/opendaylight/yangtools/openconfig/model/api/OpenConfigHashedValueEffectiveStatement.java b/yang/openconfig-model-api/src/main/java/org/opendaylight/yangtools/openconfig/model/api/OpenConfigHashedValueEffectiveStatement.java index 5ee1197d6c..ad768b0267 100644 --- a/yang/openconfig-model-api/src/main/java/org/opendaylight/yangtools/openconfig/model/api/OpenConfigHashedValueEffectiveStatement.java +++ b/yang/openconfig-model-api/src/main/java/org/opendaylight/yangtools/openconfig/model/api/OpenConfigHashedValueEffectiveStatement.java @@ -7,6 +7,7 @@ */ package org.opendaylight.yangtools.openconfig.model.api; +import org.opendaylight.yangtools.yang.common.Empty; import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; /** @@ -16,6 +17,6 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; * @author Robert Varga */ public interface OpenConfigHashedValueEffectiveStatement - extends EffectiveStatement { + extends EffectiveStatement { } diff --git a/yang/openconfig-model-api/src/main/java/org/opendaylight/yangtools/openconfig/model/api/OpenConfigHashedValueStatement.java b/yang/openconfig-model-api/src/main/java/org/opendaylight/yangtools/openconfig/model/api/OpenConfigHashedValueStatement.java index f96439a180..464aa0ffe6 100644 --- a/yang/openconfig-model-api/src/main/java/org/opendaylight/yangtools/openconfig/model/api/OpenConfigHashedValueStatement.java +++ b/yang/openconfig-model-api/src/main/java/org/opendaylight/yangtools/openconfig/model/api/OpenConfigHashedValueStatement.java @@ -7,6 +7,7 @@ */ package org.opendaylight.yangtools.openconfig.model.api; +import org.opendaylight.yangtools.yang.common.Empty; import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement; /** @@ -15,6 +16,6 @@ import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement; * * @author Robert Varga */ -public interface OpenConfigHashedValueStatement extends UnknownStatement { +public interface OpenConfigHashedValueStatement extends UnknownStatement { } diff --git a/yang/openconfig-parser-support/src/main/java/org/opendaylight/yangtools/openconfig/parser/AbstractHashedValueStatementSupport.java b/yang/openconfig-parser-support/src/main/java/org/opendaylight/yangtools/openconfig/parser/AbstractHashedValueStatementSupport.java index ca8d0f17aa..d2003a185b 100644 --- a/yang/openconfig-parser-support/src/main/java/org/opendaylight/yangtools/openconfig/parser/AbstractHashedValueStatementSupport.java +++ b/yang/openconfig-parser-support/src/main/java/org/opendaylight/yangtools/openconfig/parser/AbstractHashedValueStatementSupport.java @@ -13,6 +13,7 @@ import com.google.common.collect.ImmutableList; import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.openconfig.model.api.OpenConfigHashedValueEffectiveStatement; import org.opendaylight.yangtools.openconfig.model.api.OpenConfigHashedValueStatement; +import org.opendaylight.yangtools.yang.common.Empty; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement; @@ -20,14 +21,14 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithoutArgument.WithSubstatements; import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.UnknownEffectiveStatementBase; -import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractVoidStatementSupport; +import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractEmptyStatementSupport; import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current; import org.opendaylight.yangtools.yang.parser.spi.meta.SchemaPathSupport; import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext; import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator; abstract class AbstractHashedValueStatementSupport - extends AbstractVoidStatementSupport { + extends AbstractEmptyStatementSupport { private static final class Declared extends WithSubstatements implements OpenConfigHashedValueStatement { private final @NonNull StatementDefinition definition; @@ -45,12 +46,12 @@ abstract class AbstractHashedValueStatementSupport } private static final class Effective - extends UnknownEffectiveStatementBase + extends UnknownEffectiveStatementBase implements OpenConfigHashedValueEffectiveStatement { private final @NonNull StatementDefinition definition; private final @NonNull Object path; - Effective(final Current stmt, + Effective(final Current stmt, final ImmutableList> substatements) { super(stmt, substatements); definition = stmt.publicDefinition(); @@ -89,20 +90,20 @@ abstract class AbstractHashedValueStatementSupport @Override protected final OpenConfigHashedValueStatement createDeclared( - final StmtContext ctx, + final StmtContext ctx, final ImmutableList> substatements) { return new Declared(getPublicView(), substatements); } @Override protected final OpenConfigHashedValueStatement createEmptyDeclared( - final StmtContext ctx) { + final StmtContext ctx) { return createDeclared(ctx, ImmutableList.of()); } @Override protected OpenConfigHashedValueEffectiveStatement createEffective( - final Current stmt, + final Current stmt, final ImmutableList> substatements) { return new Effective(stmt, substatements); } diff --git a/yang/rfc6241-model-api/src/main/java/module-info.java b/yang/rfc6241-model-api/src/main/java/module-info.java index a75803806b..033edfc2d1 100644 --- a/yang/rfc6241-model-api/src/main/java/module-info.java +++ b/yang/rfc6241-model-api/src/main/java/module-info.java @@ -11,4 +11,5 @@ module org.opendaylight.yangtools.rfc6241.model.api { exports org.opendaylight.yangtools.rfc6241.model.api; requires transitive org.opendaylight.yangtools.yang.model.api; + requires org.opendaylight.yangtools.yang.common; } diff --git a/yang/rfc6241-model-api/src/main/java/org/opendaylight/yangtools/rfc6241/model/api/GetFilterElementAttributesEffectiveStatement.java b/yang/rfc6241-model-api/src/main/java/org/opendaylight/yangtools/rfc6241/model/api/GetFilterElementAttributesEffectiveStatement.java index 3c9cfac801..c55c894880 100644 --- a/yang/rfc6241-model-api/src/main/java/org/opendaylight/yangtools/rfc6241/model/api/GetFilterElementAttributesEffectiveStatement.java +++ b/yang/rfc6241-model-api/src/main/java/org/opendaylight/yangtools/rfc6241/model/api/GetFilterElementAttributesEffectiveStatement.java @@ -8,6 +8,7 @@ package org.opendaylight.yangtools.rfc6241.model.api; import com.google.common.annotations.Beta; +import org.opendaylight.yangtools.yang.common.Empty; import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; @@ -17,7 +18,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; */ @Beta public interface GetFilterElementAttributesEffectiveStatement - extends EffectiveStatement { + extends EffectiveStatement { @Override default StatementDefinition statementDefinition() { return NetconfStatements.GET_FILTER_ELEMENT_ATTRIBUTES; diff --git a/yang/rfc6241-model-api/src/main/java/org/opendaylight/yangtools/rfc6241/model/api/GetFilterElementAttributesStatement.java b/yang/rfc6241-model-api/src/main/java/org/opendaylight/yangtools/rfc6241/model/api/GetFilterElementAttributesStatement.java index d69f200bf2..6b6814dad8 100644 --- a/yang/rfc6241-model-api/src/main/java/org/opendaylight/yangtools/rfc6241/model/api/GetFilterElementAttributesStatement.java +++ b/yang/rfc6241-model-api/src/main/java/org/opendaylight/yangtools/rfc6241/model/api/GetFilterElementAttributesStatement.java @@ -8,6 +8,7 @@ package org.opendaylight.yangtools.rfc6241.model.api; import com.google.common.annotations.Beta; +import org.opendaylight.yangtools.yang.common.Empty; import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement; @@ -16,7 +17,7 @@ import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement; * RFC6241. */ @Beta -public interface GetFilterElementAttributesStatement extends UnknownStatement { +public interface GetFilterElementAttributesStatement extends UnknownStatement { @Override default StatementDefinition statementDefinition() { return NetconfStatements.GET_FILTER_ELEMENT_ATTRIBUTES; diff --git a/yang/rfc6241-parser-support/src/main/java/org/opendaylight/yangtools/rfc6241/parser/GetFilterElementAttributesStatementSupport.java b/yang/rfc6241-parser-support/src/main/java/org/opendaylight/yangtools/rfc6241/parser/GetFilterElementAttributesStatementSupport.java index 2e403bd7f6..f7c8b07fd6 100644 --- a/yang/rfc6241-parser-support/src/main/java/org/opendaylight/yangtools/rfc6241/parser/GetFilterElementAttributesStatementSupport.java +++ b/yang/rfc6241-parser-support/src/main/java/org/opendaylight/yangtools/rfc6241/parser/GetFilterElementAttributesStatementSupport.java @@ -14,6 +14,7 @@ import org.opendaylight.yangtools.rfc6241.model.api.GetFilterElementAttributesEf import org.opendaylight.yangtools.rfc6241.model.api.GetFilterElementAttributesSchemaNode; import org.opendaylight.yangtools.rfc6241.model.api.GetFilterElementAttributesStatement; import org.opendaylight.yangtools.rfc6241.model.api.NetconfStatements; +import org.opendaylight.yangtools.yang.common.Empty; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; @@ -22,7 +23,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithoutArgument.WithSubstatements; import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.UnknownEffectiveStatementBase; -import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractVoidStatementSupport; +import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractEmptyStatementSupport; import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current; import org.opendaylight.yangtools.yang.parser.spi.meta.SchemaPathSupport; import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext; @@ -32,7 +33,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Beta -public final class GetFilterElementAttributesStatementSupport extends AbstractVoidStatementSupport< +public final class GetFilterElementAttributesStatementSupport extends AbstractEmptyStatementSupport< GetFilterElementAttributesStatement, GetFilterElementAttributesEffectiveStatement> { private static final class Declared extends WithSubstatements implements GetFilterElementAttributesStatement { @@ -44,11 +45,11 @@ public final class GetFilterElementAttributesStatementSupport extends AbstractVo } private static final class Effective - extends UnknownEffectiveStatementBase + extends UnknownEffectiveStatementBase implements GetFilterElementAttributesEffectiveStatement, GetFilterElementAttributesSchemaNode { private final @NonNull Object path; - Effective(final Current stmt, + Effective(final Current stmt, final ImmutableList> substatements) { super(stmt, substatements); path = SchemaPathSupport.toEffectivePath(stmt.getEffectiveParent().getSchemaPath() @@ -88,7 +89,7 @@ public final class GetFilterElementAttributesStatementSupport extends AbstractVo } @Override - public void onFullDefinitionDeclared(final Mutable stmt) { super.onFullDefinitionDeclared(stmt); stmt.setIsSupportedToBuildEffective(computeSupported(stmt)); @@ -101,20 +102,20 @@ public final class GetFilterElementAttributesStatementSupport extends AbstractVo @Override protected GetFilterElementAttributesStatement createDeclared( - final StmtContext ctx, + final StmtContext ctx, final ImmutableList> substatements) { return new Declared(substatements); } @Override protected GetFilterElementAttributesStatement createEmptyDeclared( - final StmtContext ctx) { + final StmtContext ctx) { return Declared.EMPTY; } @Override protected GetFilterElementAttributesEffectiveStatement createEffective( - final Current stmt, + final Current stmt, final ImmutableList> substatements) { return new Effective(stmt, substatements); } diff --git a/yang/rfc6536-model-api/src/main/java/module-info.java b/yang/rfc6536-model-api/src/main/java/module-info.java index 8fa10ef96d..f94d46c866 100644 --- a/yang/rfc6536-model-api/src/main/java/module-info.java +++ b/yang/rfc6536-model-api/src/main/java/module-info.java @@ -11,4 +11,5 @@ module org.opendaylight.yangtools.rfc6536.model.api { exports org.opendaylight.yangtools.rfc6536.model.api; requires transitive org.opendaylight.yangtools.yang.model.api; + requires org.opendaylight.yangtools.yang.common; } diff --git a/yang/rfc6536-model-api/src/main/java/org/opendaylight/yangtools/rfc6536/model/api/DefaultDenyAllEffectiveStatement.java b/yang/rfc6536-model-api/src/main/java/org/opendaylight/yangtools/rfc6536/model/api/DefaultDenyAllEffectiveStatement.java index f386bcc68b..6c54a84705 100644 --- a/yang/rfc6536-model-api/src/main/java/org/opendaylight/yangtools/rfc6536/model/api/DefaultDenyAllEffectiveStatement.java +++ b/yang/rfc6536-model-api/src/main/java/org/opendaylight/yangtools/rfc6536/model/api/DefaultDenyAllEffectiveStatement.java @@ -8,6 +8,7 @@ package org.opendaylight.yangtools.rfc6536.model.api; import com.google.common.annotations.Beta; +import org.opendaylight.yangtools.yang.common.Empty; import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; @@ -16,7 +17,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; * RFC6536. */ @Beta -public interface DefaultDenyAllEffectiveStatement extends EffectiveStatement { +public interface DefaultDenyAllEffectiveStatement extends EffectiveStatement { @Override default StatementDefinition statementDefinition() { return NACMStatements.DEFAULT_DENY_ALL; diff --git a/yang/rfc6536-model-api/src/main/java/org/opendaylight/yangtools/rfc6536/model/api/DefaultDenyAllStatement.java b/yang/rfc6536-model-api/src/main/java/org/opendaylight/yangtools/rfc6536/model/api/DefaultDenyAllStatement.java index 1be4602731..75525de3e0 100644 --- a/yang/rfc6536-model-api/src/main/java/org/opendaylight/yangtools/rfc6536/model/api/DefaultDenyAllStatement.java +++ b/yang/rfc6536-model-api/src/main/java/org/opendaylight/yangtools/rfc6536/model/api/DefaultDenyAllStatement.java @@ -8,6 +8,7 @@ package org.opendaylight.yangtools.rfc6536.model.api; import com.google.common.annotations.Beta; +import org.opendaylight.yangtools.yang.common.Empty; import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement; @@ -16,7 +17,7 @@ import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement; * RFC6536. */ @Beta -public interface DefaultDenyAllStatement extends UnknownStatement { +public interface DefaultDenyAllStatement extends UnknownStatement { @Override default StatementDefinition statementDefinition() { return NACMStatements.DEFAULT_DENY_ALL; diff --git a/yang/rfc6536-model-api/src/main/java/org/opendaylight/yangtools/rfc6536/model/api/DefaultDenyWriteEffectiveStatement.java b/yang/rfc6536-model-api/src/main/java/org/opendaylight/yangtools/rfc6536/model/api/DefaultDenyWriteEffectiveStatement.java index 6e749fdfbe..19cceea40e 100644 --- a/yang/rfc6536-model-api/src/main/java/org/opendaylight/yangtools/rfc6536/model/api/DefaultDenyWriteEffectiveStatement.java +++ b/yang/rfc6536-model-api/src/main/java/org/opendaylight/yangtools/rfc6536/model/api/DefaultDenyWriteEffectiveStatement.java @@ -8,6 +8,7 @@ package org.opendaylight.yangtools.rfc6536.model.api; import com.google.common.annotations.Beta; +import org.opendaylight.yangtools.yang.common.Empty; import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; @@ -16,7 +17,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; * RFC6536. */ @Beta -public interface DefaultDenyWriteEffectiveStatement extends EffectiveStatement { +public interface DefaultDenyWriteEffectiveStatement extends EffectiveStatement { @Override default StatementDefinition statementDefinition() { return NACMStatements.DEFAULT_DENY_WRITE; diff --git a/yang/rfc6536-model-api/src/main/java/org/opendaylight/yangtools/rfc6536/model/api/DefaultDenyWriteStatement.java b/yang/rfc6536-model-api/src/main/java/org/opendaylight/yangtools/rfc6536/model/api/DefaultDenyWriteStatement.java index 856dc8f34e..df6769ad81 100644 --- a/yang/rfc6536-model-api/src/main/java/org/opendaylight/yangtools/rfc6536/model/api/DefaultDenyWriteStatement.java +++ b/yang/rfc6536-model-api/src/main/java/org/opendaylight/yangtools/rfc6536/model/api/DefaultDenyWriteStatement.java @@ -8,6 +8,7 @@ package org.opendaylight.yangtools.rfc6536.model.api; import com.google.common.annotations.Beta; +import org.opendaylight.yangtools.yang.common.Empty; import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement; @@ -16,7 +17,7 @@ import org.opendaylight.yangtools.yang.model.api.stmt.UnknownStatement; * RFC6536. */ @Beta -public interface DefaultDenyWriteStatement extends UnknownStatement { +public interface DefaultDenyWriteStatement extends UnknownStatement { @Override default StatementDefinition statementDefinition() { return NACMStatements.DEFAULT_DENY_WRITE; diff --git a/yang/rfc6536-parser-support/src/main/java/org/opendaylight/yangtools/rfc6536/parser/DefaultDenyAllStatementSupport.java b/yang/rfc6536-parser-support/src/main/java/org/opendaylight/yangtools/rfc6536/parser/DefaultDenyAllStatementSupport.java index d46f33d7a2..39b19eaaa0 100644 --- a/yang/rfc6536-parser-support/src/main/java/org/opendaylight/yangtools/rfc6536/parser/DefaultDenyAllStatementSupport.java +++ b/yang/rfc6536-parser-support/src/main/java/org/opendaylight/yangtools/rfc6536/parser/DefaultDenyAllStatementSupport.java @@ -13,6 +13,7 @@ import org.opendaylight.yangtools.rfc6536.model.api.DefaultDenyAllEffectiveState import org.opendaylight.yangtools.rfc6536.model.api.DefaultDenyAllSchemaNode; import org.opendaylight.yangtools.rfc6536.model.api.DefaultDenyAllStatement; import org.opendaylight.yangtools.rfc6536.model.api.NACMStatements; +import org.opendaylight.yangtools.yang.common.Empty; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement; @@ -20,14 +21,14 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithoutArgument.WithSubstatements; import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.UnknownEffectiveStatementBase; -import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractVoidStatementSupport; +import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractEmptyStatementSupport; import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current; import org.opendaylight.yangtools.yang.parser.spi.meta.SchemaPathSupport; import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext; import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator; public final class DefaultDenyAllStatementSupport - extends AbstractVoidStatementSupport { + extends AbstractEmptyStatementSupport { private static final class Declared extends WithSubstatements implements DefaultDenyAllStatement { static final @NonNull Declared EMPTY = new Declared(ImmutableList.of()); @@ -36,11 +37,11 @@ public final class DefaultDenyAllStatementSupport } } - private static final class Effective extends UnknownEffectiveStatementBase + private static final class Effective extends UnknownEffectiveStatementBase implements DefaultDenyAllEffectiveStatement, DefaultDenyAllSchemaNode { private final @NonNull Object path; - Effective(final Current stmt, + Effective(final Current stmt, final ImmutableList> substatements) { super(stmt, substatements); path = SchemaPathSupport.toEffectivePath(stmt.getEffectiveParent().getSchemaPath() @@ -84,18 +85,18 @@ public final class DefaultDenyAllStatementSupport } @Override - protected DefaultDenyAllStatement createDeclared(final StmtContext ctx, + protected DefaultDenyAllStatement createDeclared(final StmtContext ctx, final ImmutableList> substatements) { return new Declared(substatements); } @Override - protected DefaultDenyAllStatement createEmptyDeclared(final StmtContext ctx) { + protected DefaultDenyAllStatement createEmptyDeclared(final StmtContext ctx) { return Declared.EMPTY; } @Override - protected DefaultDenyAllEffectiveStatement createEffective(final Current stmt, + protected DefaultDenyAllEffectiveStatement createEffective(final Current stmt, final ImmutableList> substatements) { return new Effective(stmt, substatements); } diff --git a/yang/rfc6536-parser-support/src/main/java/org/opendaylight/yangtools/rfc6536/parser/DefaultDenyWriteStatementSupport.java b/yang/rfc6536-parser-support/src/main/java/org/opendaylight/yangtools/rfc6536/parser/DefaultDenyWriteStatementSupport.java index 7c580b0195..dd4fd2e22f 100644 --- a/yang/rfc6536-parser-support/src/main/java/org/opendaylight/yangtools/rfc6536/parser/DefaultDenyWriteStatementSupport.java +++ b/yang/rfc6536-parser-support/src/main/java/org/opendaylight/yangtools/rfc6536/parser/DefaultDenyWriteStatementSupport.java @@ -13,6 +13,7 @@ import org.opendaylight.yangtools.rfc6536.model.api.DefaultDenyWriteEffectiveSta import org.opendaylight.yangtools.rfc6536.model.api.DefaultDenyWriteSchemaNode; import org.opendaylight.yangtools.rfc6536.model.api.DefaultDenyWriteStatement; import org.opendaylight.yangtools.rfc6536.model.api.NACMStatements; +import org.opendaylight.yangtools.yang.common.Empty; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement; @@ -20,14 +21,14 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithoutArgument.WithSubstatements; import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.UnknownEffectiveStatementBase; -import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractVoidStatementSupport; +import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractEmptyStatementSupport; import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current; import org.opendaylight.yangtools.yang.parser.spi.meta.SchemaPathSupport; import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext; import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator; public final class DefaultDenyWriteStatementSupport - extends AbstractVoidStatementSupport { + extends AbstractEmptyStatementSupport { private static final class Declared extends WithSubstatements implements DefaultDenyWriteStatement { static final @NonNull Declared EMPTY = new Declared(ImmutableList.of()); @@ -36,11 +37,11 @@ public final class DefaultDenyWriteStatementSupport } } - private static final class Effective extends UnknownEffectiveStatementBase + private static final class Effective extends UnknownEffectiveStatementBase implements DefaultDenyWriteEffectiveStatement, DefaultDenyWriteSchemaNode { private final @NonNull Object path; - Effective(final Current stmt, + Effective(final Current stmt, final ImmutableList> substatements) { super(stmt, substatements); path = SchemaPathSupport.toEffectivePath(stmt.getEffectiveParent().getSchemaPath() @@ -84,18 +85,19 @@ public final class DefaultDenyWriteStatementSupport } @Override - protected DefaultDenyWriteStatement createDeclared(final StmtContext ctx, + protected DefaultDenyWriteStatement createDeclared(final StmtContext ctx, final ImmutableList> substatements) { return new Declared(substatements); } @Override - protected DefaultDenyWriteStatement createEmptyDeclared(final StmtContext ctx) { + protected DefaultDenyWriteStatement createEmptyDeclared( + final StmtContext ctx) { return Declared.EMPTY; } @Override - protected DefaultDenyWriteEffectiveStatement createEffective(final Current stmt, + protected DefaultDenyWriteEffectiveStatement createEffective(final Current stmt, final ImmutableList> substatements) { return new Effective(stmt, substatements); } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/meta/EffectiveStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/meta/EffectiveStatement.java index bff2296f69..fe8d8b2522 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/meta/EffectiveStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/meta/EffectiveStatement.java @@ -14,11 +14,12 @@ import java.util.Optional; import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.common.Empty; /** * Effective model statement which should be used to derive application behaviour. * - * @param Argument type ({@link Void} if statement does not have argument.) + * @param Argument type ({@link Empty} if statement does not have argument.) * @param Class representing declared version of this statement. */ public interface EffectiveStatement> extends ModelStatement { diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/meta/ModelStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/meta/ModelStatement.java index 0adbc6aba5..36aacd7998 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/meta/ModelStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/meta/ModelStatement.java @@ -8,6 +8,7 @@ package org.opendaylight.yangtools.yang.model.api.meta; import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.Empty; /** * Model statement. There are two base types of model statements: @@ -25,7 +26,7 @@ import org.eclipse.jdt.annotation.NonNull; * * * - * @param Argument type ({@link Void} if statement does not have argument.) + * @param Argument type ({@link Empty} if statement does not have argument.) */ public interface ModelStatement { /** @@ -38,9 +39,9 @@ public interface ModelStatement { /** * Returns statement argument. * - * @return statement argument or null if statement does not have argument. + * @return statement argument. */ - A argument(); + @NonNull A argument(); /** * Returns statement source, which denotes if statement was diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ArgumentStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ArgumentStatement.java index 3de58eabef..39b6d8252c 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ArgumentStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ArgumentStatement.java @@ -7,10 +7,7 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - import java.util.Optional; -import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; @@ -24,11 +21,6 @@ public interface ArgumentStatement extends DeclaredStatement { return YangStmtMapping.ARGUMENT; } - default @NonNull QName getName() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } - default @Nullable YinElementStatement getYinElement() { final Optional opt = findFirstDeclaredSubstatement(YinElementStatement.class); return opt.isPresent() ? opt.get() : null; diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/AugmentStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/AugmentStatement.java index 2084abb952..b502b161d2 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/AugmentStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/AugmentStatement.java @@ -7,8 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - import java.util.Collection; import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; @@ -25,11 +23,7 @@ public interface AugmentStatement extends WithStatus, return YangStmtMapping.AUGMENT; } - default @NonNull SchemaNodeIdentifier getTargetNode() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } - + // FIXME: 7.0.0: determine the utility of this method default @NonNull Collection getCases() { return declaredSubstatements(CaseStatement.class); } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/BaseStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/BaseStatement.java index 0ca3aa558e..33d19ad00a 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/BaseStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/BaseStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement; @@ -20,9 +17,4 @@ public interface BaseStatement extends DeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.BASE; } - - default @NonNull QName getName() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/BelongsToStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/BelongsToStatement.java index 073bab840a..deea2ef175 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/BelongsToStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/BelongsToStatement.java @@ -7,8 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement; @@ -20,11 +18,6 @@ public interface BelongsToStatement extends DeclaredStatement { return YangStmtMapping.BELONGS_TO; } - default @NonNull String getModule() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } - default @NonNull PrefixStatement getPrefix() { return findFirstDeclaredSubstatement(PrefixStatement.class).get(); } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/BitStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/BitStatement.java index 99c62694b8..781c10e017 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/BitStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/BitStatement.java @@ -7,10 +7,7 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - 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; @@ -22,11 +19,6 @@ public interface BitStatement extends DocumentedDeclaredStatement.WithStatus opt = findFirstDeclaredSubstatement(PositionStatement.class); return opt.isPresent() ? opt.get() : null; diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/CaseStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/CaseStatement.java index 389b9c71f0..2b0f99ac68 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/CaseStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/CaseStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; @@ -20,9 +17,4 @@ public interface CaseStatement extends DocumentedDeclaredStatement.WithStatus { default StatementDefinition statementDefinition() { return YangStmtMapping.CONTACT; } - - default @NonNull String getText() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(rawArgument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DataDefinitionStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DataDefinitionStatement.java index e66018d53d..7384c77078 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DataDefinitionStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DataDefinitionStatement.java @@ -7,15 +7,11 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.common.QName; /** - * Statement that defines new data nodes. - * One of container, leaf, leaf-list, list, choice, case, - * augment, uses, anyxml and anydata. + * Statement that defines new data nodes. One of container, leaf, leaf-list, list, choice, case, augment, uses, anyxml + * and anydata. * *

* Defined in: RFC6020, Section 3 @@ -23,8 +19,5 @@ import org.opendaylight.yangtools.yang.common.QName; @Rfc6020AbnfRule("data-def-stmt") public interface DataDefinitionStatement extends DocumentedDeclaredStatement.WithStatus, WhenStatementAwareDeclaredStatement { - default @NonNull QName getName() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } + } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DefaultStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DefaultStatement.java index d90bd75dd0..b317f5d33d 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DefaultStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DefaultStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; 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.StatementDefinition; @@ -19,9 +16,4 @@ public interface DefaultStatement extends DeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.DEFAULT; } - - default @NonNull String getValue() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DescriptionStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DescriptionStatement.java index 611cd4e0c9..24b9ab2535 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DescriptionStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DescriptionStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; 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.StatementDefinition; @@ -19,10 +16,5 @@ public interface DescriptionStatement extends DeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.DESCRIPTION; } - - default @NonNull String getText() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DeviateStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DeviateStatement.java index 719eabbc5d..5930391425 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DeviateStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DeviateStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.DeviateKind; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement; @@ -20,9 +17,4 @@ public interface DeviateStatement extends DeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.DEVIATE; } - - default @NonNull DeviateKind getValue() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DeviationStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DeviationStatement.java index 1369240c47..19276d8b51 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DeviationStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/DeviationStatement.java @@ -7,8 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - import java.util.Collection; import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; @@ -21,11 +19,7 @@ public interface DeviationStatement extends DocumentedDeclaredStatement getDeviateStatements() { return declaredSubstatements(DeviateStatement.class); } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/EnumStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/EnumStatement.java index 08547d3331..309c56d579 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/EnumStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/EnumStatement.java @@ -7,10 +7,7 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - 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; @@ -22,11 +19,6 @@ public interface EnumStatement extends DocumentedDeclaredStatement.WithStatus opt = findFirstDeclaredSubstatement(ValueStatement.class); return opt.isPresent() ? opt.get() : null; diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ErrorAppTagStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ErrorAppTagStatement.java index 23dca9fcb5..0d370a2177 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ErrorAppTagStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ErrorAppTagStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; 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.StatementDefinition; @@ -19,10 +16,5 @@ public interface ErrorAppTagStatement extends DeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.ERROR_APP_TAG; } - - default @NonNull String getValue() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ErrorMessageStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ErrorMessageStatement.java index fd49abcae2..9d1ff36a61 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ErrorMessageStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ErrorMessageStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; 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.StatementDefinition; @@ -19,10 +16,5 @@ public interface ErrorMessageStatement extends DeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.ERROR_MESSAGE; } - - default @NonNull String getValue() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/FeatureStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/FeatureStatement.java index b485cb317f..1c5c44f956 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/FeatureStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/FeatureStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; @@ -20,9 +17,4 @@ public interface FeatureStatement extends DocumentedDeclaredStatement.WithStatus default StatementDefinition statementDefinition() { return YangStmtMapping.FEATURE; } - - default @NonNull QName getName() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/GroupingStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/GroupingStatement.java index 4bde14c318..c09d8d7f18 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/GroupingStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/GroupingStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; @@ -21,9 +18,4 @@ public interface GroupingStatement extends DocumentedDeclaredStatement.WithStatu default StatementDefinition statementDefinition() { return YangStmtMapping.GROUPING; } - - default @NonNull QName getName() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/IdentityStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/IdentityStatement.java index 7a2ff3c1c2..c4c31f0b9d 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/IdentityStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/IdentityStatement.java @@ -7,8 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - import java.util.Collection; import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.common.QName; @@ -22,11 +20,6 @@ public interface IdentityStatement extends DocumentedDeclaredStatement.WithStatu return YangStmtMapping.IDENTITY; } - default @NonNull QName getName() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } - /** * Returns the base identities of this identity. * diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/IfFeatureStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/IfFeatureStatement.java index 797cd2e3b8..d090ceb3ae 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/IfFeatureStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/IfFeatureStatement.java @@ -7,8 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - import com.google.common.annotations.Beta; import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; @@ -32,8 +30,8 @@ public interface IfFeatureStatement extends DeclaredStatement { * @return Predicate on a collection of QNames against which to evaluate */ @Beta + // FIXME: YANGTOOLS-908: remove this method default @NonNull IfFeatureExpr getIfFeaturePredicate() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); + return argument(); } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ImportStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ImportStatement.java index 68f6fc6c62..50822ffa07 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ImportStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ImportStatement.java @@ -7,8 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - import java.util.Optional; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; @@ -21,11 +19,6 @@ public interface ImportStatement extends DocumentedDeclaredStatement { return YangStmtMapping.IMPORT; } - default @NonNull String getModule() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(rawArgument()); - } - default @NonNull PrefixStatement getPrefix() { return findFirstDeclaredSubstatement(PrefixStatement.class).get(); } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/IncludeStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/IncludeStatement.java index 05e4196f8f..43dc464c78 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/IncludeStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/IncludeStatement.java @@ -7,10 +7,7 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - 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; @@ -21,11 +18,6 @@ public interface IncludeStatement extends DocumentedDeclaredStatement { return YangStmtMapping.INCLUDE; } - default @NonNull String getModule() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } - default @Nullable RevisionDateStatement getRevisionDate() { final Optional opt = findFirstDeclaredSubstatement(RevisionDateStatement.class); return opt.isPresent() ? opt.get() : null; diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/MandatoryStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/MandatoryStatement.java index 00b340afbb..fafd675813 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/MandatoryStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/MandatoryStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; 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.StatementDefinition; @@ -20,8 +17,7 @@ public interface MandatoryStatement extends DeclaredStatement { return YangStmtMapping.MANDATORY; } - default @NonNull Boolean getValue() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); + default boolean getValue() { + return argument(); } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/MaxElementsStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/MaxElementsStatement.java index 9fe75c4f73..30d2c349fa 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/MaxElementsStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/MaxElementsStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; 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.StatementDefinition; @@ -19,9 +16,4 @@ public interface MaxElementsStatement extends DeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.MAX_ELEMENTS; } - - default @NonNull String getValue() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/MinElementsStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/MinElementsStatement.java index 20c50fa96f..169291cbb4 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/MinElementsStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/MinElementsStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; 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.StatementDefinition; @@ -19,9 +16,4 @@ public interface MinElementsStatement extends DeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.MIN_ELEMENTS; } - - default @NonNull Integer getValue() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ModifierStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ModifierStatement.java index 3941b55e58..78e50aa5c0 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ModifierStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ModifierStatement.java @@ -8,10 +8,7 @@ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - import com.google.common.annotations.Beta; -import org.eclipse.jdt.annotation.NonNull; 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.StatementDefinition; @@ -31,9 +28,4 @@ public interface ModifierStatement extends DeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.MODIFIER; } - - default @NonNull ModifierKind getValue() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ModuleStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ModuleStatement.java index e9ee57446b..bdfbe66f6a 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ModuleStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ModuleStatement.java @@ -7,10 +7,7 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - import java.util.Optional; -import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.common.UnqualifiedQName; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; @@ -22,11 +19,6 @@ public interface ModuleStatement extends MetaDeclaredStatement return YangStmtMapping.MODULE; } - default @NonNull String getName() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(rawArgument()); - } - @Override default YangVersionStatement getYangVersion() { final Optional opt = findFirstDeclaredSubstatement(YangVersionStatement.class); diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/MustStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/MustStatement.java index 926573feef..18af2e8726 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/MustStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/MustStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; import org.opendaylight.yangtools.yang.xpath.api.YangXPathExpression.QualifiedBound; @@ -19,9 +16,4 @@ public interface MustStatement extends ConstrainedDocumentedDeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.NAMESPACE; } - - default @NonNull URI getUri() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/NamespacedEffectiveStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/NamespacedEffectiveStatement.java index 3fb7ee28fd..c3df735c0f 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/NamespacedEffectiveStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/NamespacedEffectiveStatement.java @@ -7,8 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - import com.google.common.annotations.Beta; import org.opendaylight.yangtools.concepts.Identifiable; import org.opendaylight.yangtools.yang.common.QName; @@ -28,6 +26,6 @@ public interface NamespacedEffectiveStatement @Override default QName getIdentifier() { - return verifyNotNull(argument()); + return argument(); } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/NotificationStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/NotificationStatement.java index 4e9d061ef9..5cb43f886f 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/NotificationStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/NotificationStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; @@ -21,9 +18,4 @@ public interface NotificationStatement extends DocumentedDeclaredStatement.WithS default StatementDefinition statementDefinition() { return YangStmtMapping.NOTIFICATION; } - - default @NonNull QName getName() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/OperationDeclaredStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/OperationDeclaredStatement.java index c847992e8a..32a4ed8c4a 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/OperationDeclaredStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/OperationDeclaredStatement.java @@ -7,8 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - import com.google.common.annotations.Beta; import java.util.Collection; import java.util.Optional; @@ -21,11 +19,6 @@ import org.opendaylight.yangtools.yang.common.QName; @Beta public interface OperationDeclaredStatement extends DocumentedDeclaredStatement.WithStatus, IfFeatureAwareDeclaredStatement { - default @NonNull QName getName() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } - default @NonNull Optional getInput() { return findFirstDeclaredSubstatement(InputStatement.class); } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/OrderedByStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/OrderedByStatement.java index 9eccb0e47b..212b9879a4 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/OrderedByStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/OrderedByStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.common.Ordering; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement; @@ -20,9 +17,4 @@ public interface OrderedByStatement extends DeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.ORDERED_BY; } - - default @NonNull Ordering getValue() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/OrganizationStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/OrganizationStatement.java index e1f0e25a12..7359c0754d 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/OrganizationStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/OrganizationStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; 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.StatementDefinition; @@ -19,9 +16,4 @@ public interface OrganizationStatement extends DeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.ORGANIZATION; } - - default @NonNull String getText() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/PathStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/PathStatement.java index bfec882c9c..8e4779c348 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/PathStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/PathStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.PathExpression; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement; @@ -20,9 +17,4 @@ public interface PathStatement extends DeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.PATH; } - - default @NonNull PathExpression getValue() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/PositionStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/PositionStatement.java index 02749091f4..88776d3a80 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/PositionStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/PositionStatement.java @@ -7,8 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - import org.opendaylight.yangtools.yang.common.Uint32; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement; @@ -19,9 +17,4 @@ public interface PositionStatement extends DeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.POSITION; } - - default Uint32 getValue() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/PrefixStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/PrefixStatement.java index 96a3c201b5..306b2071e6 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/PrefixStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/PrefixStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; 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.StatementDefinition; @@ -19,9 +16,4 @@ public interface PrefixStatement extends DeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.PREFIX; } - - default @NonNull String getValue() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(rawArgument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/PresenceStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/PresenceStatement.java index fa2ad2143e..c75574dcc7 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/PresenceStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/PresenceStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; 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.StatementDefinition; @@ -19,9 +16,4 @@ public interface PresenceStatement extends DeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.PRESENCE; } - - default @NonNull String getValue() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ReferenceStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ReferenceStatement.java index 1e2d0c312a..3e44c892a9 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ReferenceStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/ReferenceStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; 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.StatementDefinition; @@ -19,9 +16,4 @@ public interface ReferenceStatement extends DeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.REFERENCE; } - - default @NonNull String getText() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(rawArgument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/RefineStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/RefineStatement.java index 2297936292..f3696cfb8e 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/RefineStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/RefineStatement.java @@ -7,8 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - import java.util.Collection; import java.util.Optional; import org.eclipse.jdt.annotation.NonNull; @@ -26,11 +24,6 @@ public interface RefineStatement extends ConfigStatementAwareDeclaredStatement getDefaults() { return declaredSubstatements(DefaultStatement.class); } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/RevisionDateStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/RevisionDateStatement.java index 1e53d113c3..88e377c1e4 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/RevisionDateStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/RevisionDateStatement.java @@ -17,8 +17,4 @@ public interface RevisionDateStatement extends DeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.REVISION_DATE; } - - default Revision getDate() { - return argument(); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/RevisionStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/RevisionStatement.java index 84e26b46d9..7fcbf873aa 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/RevisionStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/RevisionStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.common.Revision; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; @@ -19,9 +16,4 @@ public interface RevisionStatement extends DocumentedDeclaredStatement default StatementDefinition statementDefinition() { return YangStmtMapping.REVISION; } - - default @NonNull Revision getDate() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/StatusStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/StatusStatement.java index 31fb566fce..d42fc07d21 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/StatusStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/StatusStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.Status; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement; @@ -20,9 +17,4 @@ public interface StatusStatement extends DeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.STATUS; } - - default @NonNull Status getValue() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/SubmoduleStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/SubmoduleStatement.java index e8fbb918be..4672f2d139 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/SubmoduleStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/SubmoduleStatement.java @@ -7,8 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - import java.util.Optional; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; @@ -23,11 +21,6 @@ public interface SubmoduleStatement extends MetaDeclaredStatement opt = findFirstDeclaredSubstatement(YangVersionStatement.class); return opt.isPresent() ? opt.get() : null; diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/TypeStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/TypeStatement.java index 6eb2cd6978..73559549f2 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/TypeStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/TypeStatement.java @@ -7,8 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - import java.util.Collection; import java.util.Optional; import org.eclipse.jdt.annotation.NonNull; @@ -24,11 +22,6 @@ public interface TypeStatement extends DeclaredStatement { return YangStmtMapping.TYPE; } - default @NonNull String getName() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } - @Rfc6020AbnfRule("numerical-restrictions") // FIXME: 7.0.0: this interface does not have an implementation interface NumericalRestrictions extends TypeStatement { diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/TypedefStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/TypedefStatement.java index ab2896c372..56787614f7 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/TypedefStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/TypedefStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; @@ -20,9 +17,4 @@ public interface TypedefStatement extends DocumentedDeclaredStatement.WithStatus default StatementDefinition statementDefinition() { return YangStmtMapping.TYPEDEF; } - - default @NonNull QName getName() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UniqueStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UniqueStatement.java index 165f413a5c..3bd55de4b4 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UniqueStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UniqueStatement.java @@ -7,23 +7,14 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - import java.util.Set; 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.StatementDefinition; -import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Descendant; public interface UniqueStatement extends DeclaredStatement> { @Override default StatementDefinition statementDefinition() { return YangStmtMapping.UNIQUE; } - - default Set getTag() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } - diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UnitsStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UnitsStatement.java index 4aee8c9347..1dfab9484d 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UnitsStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UnitsStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; 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.StatementDefinition; @@ -19,9 +16,4 @@ public interface UnitsStatement extends DeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.UNITS; } - - default @NonNull String getName() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UnknownStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UnknownStatement.java index d4d326d8df..293b7d4f32 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UnknownStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UnknownStatement.java @@ -7,7 +7,7 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.common.Empty; import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement; /** @@ -15,10 +15,8 @@ import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement; * interfaces in this package. This interface is meant to be specialized by external semantic plugins, such that they * are properly anchored in the metamodel. * - * @param Argument type ({@link Void} if statement does not have argument.) + * @param Argument type ({@link Empty} if statement does not have argument.) */ public interface UnknownStatement extends DeclaredStatement { - default @Nullable A getArgument() { - return argument(); - } + } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UnrecognizedEffectiveStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UnrecognizedEffectiveStatement.java index 0a0af9f02d..29480585e0 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UnrecognizedEffectiveStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UnrecognizedEffectiveStatement.java @@ -11,6 +11,6 @@ import com.google.common.annotations.Beta; import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; @Beta -public interface UnrecognizedEffectiveStatement extends EffectiveStatement { +public interface UnrecognizedEffectiveStatement extends EffectiveStatement { } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UnrecognizedStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UnrecognizedStatement.java index f14c0ec5b4..6c98f990e9 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UnrecognizedStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/UnrecognizedStatement.java @@ -10,12 +10,11 @@ package org.opendaylight.yangtools.yang.model.api.stmt; import com.google.common.annotations.Beta; /** - * Common interface for unrecognized unknown statements. UnrecognizedStatement - * is an instance of a statement defined via an 'extension' statement, for which - * the parser did not have semantic support (in which case the statement would + * Common interface for unrecognized unknown statements. UnrecognizedStatement is an instance of a statement defined via + * an 'extension' statement, for which the parser did not have semantic support (in which case the statement would * result in a corresponding semantic subclass of {@link UnknownStatement}). */ @Beta -public interface UnrecognizedStatement extends UnknownStatement { +public interface UnrecognizedStatement extends UnknownStatement { } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/WhenStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/WhenStatement.java index c17a58f8b6..7807a200d4 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/WhenStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/WhenStatement.java @@ -7,9 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.api.stmt; -import static com.google.common.base.Verify.verifyNotNull; - -import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.YangStmtMapping; import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition; import org.opendaylight.yangtools.yang.xpath.api.YangXPathExpression.QualifiedBound; @@ -19,9 +16,4 @@ public interface WhenStatement extends DocumentedDeclaredStatement { default StatementDefinition statementDefinition() { return YangStmtMapping.YANG_VERSION; } - - default @NonNull YangVersion getValue() { - // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here - return verifyNotNull(argument()); - } } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/YinElementStatement.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/YinElementStatement.java index 883e92c18e..b1881a5005 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/YinElementStatement.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/YinElementStatement.java @@ -18,6 +18,6 @@ public interface YinElementStatement extends DeclaredStatement { } default boolean getValue() { - return argument().booleanValue(); + return argument(); } } diff --git a/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/AbstractDeclaredStatement.java b/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/AbstractDeclaredStatement.java index 1b149836b4..b9fc1ce5c1 100644 --- a/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/AbstractDeclaredStatement.java +++ b/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/AbstractDeclaredStatement.java @@ -7,12 +7,14 @@ */ package org.opendaylight.yangtools.yang.parser.rfc7950.stmt; +import static com.google.common.base.Verify.verifyNotNull; import static java.util.Objects.requireNonNull; import com.google.common.annotations.Beta; import com.google.common.collect.ImmutableList; import java.util.Collection; import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.Empty; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement; import org.opendaylight.yangtools.yang.model.api.meta.StatementSource; @@ -54,6 +56,21 @@ public abstract class AbstractDeclaredStatement extends AbstractModelStatemen } public abstract static class WithRawArgument extends AbstractDeclaredStatement { + public abstract static class WithSubstatements extends WithRawArgument { + private final @NonNull Object substatements; + + protected WithSubstatements(final String rawArgument, + final ImmutableList> substatements) { + super(rawArgument); + this.substatements = maskList(substatements); + } + + @Override + public final Collection> declaredSubstatements() { + return unmaskList(substatements); + } + } + private final String rawArgument; protected WithRawArgument(final String rawArgument) { @@ -89,7 +106,7 @@ public abstract class AbstractDeclaredStatement extends AbstractModelStatemen } @Override - public final @NonNull QName argument() { + public final QName argument() { return argument; } @@ -116,12 +133,12 @@ public abstract class AbstractDeclaredStatement extends AbstractModelStatemen } protected WithRawStringArgument(final String rawArgument) { - super(rawArgument); + super(verifyNotNull(rawArgument)); } @Override public final String argument() { - return rawArgument(); + return verifyNotNull(rawArgument()); } } @@ -141,11 +158,11 @@ public abstract class AbstractDeclaredStatement extends AbstractModelStatemen } } - private final A argument; + private final @NonNull A argument; protected WithArgument(final String rawArgument, final A argument) { super(rawArgument); - this.argument = argument; + this.argument = requireNonNull(argument); } @Override @@ -172,12 +189,12 @@ public abstract class AbstractDeclaredStatement extends AbstractModelStatemen private final @NonNull A argument; - protected ArgumentToString(final A argument) { + protected ArgumentToString(final @NonNull A argument) { this.argument = requireNonNull(argument); } @Override - public final @NonNull A argument() { + public final A argument() { return argument; } @@ -187,7 +204,7 @@ public abstract class AbstractDeclaredStatement extends AbstractModelStatemen } } - public abstract static class WithoutArgument extends AbstractDeclaredStatement { + public abstract static class WithoutArgument extends AbstractDeclaredStatement { public abstract static class WithSubstatements extends WithoutArgument { private final @NonNull Object substatements; @@ -202,8 +219,8 @@ public abstract class AbstractDeclaredStatement extends AbstractModelStatemen } @Override - public final Void argument() { - return null; + public final Empty argument() { + return Empty.getInstance(); } @Override diff --git a/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/extension/UnrecognizedEffectiveStatementImpl.java b/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/extension/UnrecognizedEffectiveStatementImpl.java index 3020a74172..7244fd8b47 100644 --- a/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/extension/UnrecognizedEffectiveStatementImpl.java +++ b/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/extension/UnrecognizedEffectiveStatementImpl.java @@ -24,14 +24,14 @@ import org.opendaylight.yangtools.yang.parser.spi.source.SourceException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -final class UnrecognizedEffectiveStatementImpl extends UnknownEffectiveStatementBase +final class UnrecognizedEffectiveStatementImpl extends UnknownEffectiveStatementBase implements UnrecognizedEffectiveStatement { private static final Logger LOG = LoggerFactory.getLogger(UnrecognizedEffectiveStatementImpl.class); private final QName maybeQNameArgument; private final @Nullable SchemaPath path; - UnrecognizedEffectiveStatementImpl(final Current stmt, + UnrecognizedEffectiveStatementImpl(final Current stmt, final @NonNull ImmutableList> substatements, final QName qnameArgument) { super(stmt, substatements); this.maybeQNameArgument = qnameArgument != null ? qnameArgument : getNodeType(); diff --git a/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/extension/UnrecognizedStatementImpl.java b/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/extension/UnrecognizedStatementImpl.java index 9c870874d1..bcf6021258 100644 --- a/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/extension/UnrecognizedStatementImpl.java +++ b/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/extension/UnrecognizedStatementImpl.java @@ -11,12 +11,13 @@ import static java.util.Objects.requireNonNull; import com.google.common.collect.ImmutableList; import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.common.Empty; 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.stmt.UnrecognizedStatement; -import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithRawStringArgument.WithSubstatements; +import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.AbstractDeclaredStatement.WithRawArgument.WithSubstatements; -final class UnrecognizedStatementImpl extends WithSubstatements implements UnrecognizedStatement { +final class UnrecognizedStatementImpl extends WithSubstatements implements UnrecognizedStatement { private final @NonNull StatementDefinition definition; UnrecognizedStatementImpl(final String rawArgument, final @NonNull StatementDefinition statementDefinition, @@ -29,4 +30,10 @@ final class UnrecognizedStatementImpl extends WithSubstatements implements Unrec public StatementDefinition statementDefinition() { return definition; } + + @Override + public Object argument() { + final String raw = rawArgument(); + return raw != null ? raw : Empty.getInstance(); + } } diff --git a/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/extension/UnrecognizedStatementSupport.java b/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/extension/UnrecognizedStatementSupport.java index da8eeab28f..87237df8a6 100644 --- a/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/extension/UnrecognizedStatementSupport.java +++ b/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/extension/UnrecognizedStatementSupport.java @@ -29,7 +29,7 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator; // FIXME: YANGTOOLS-1196: remove this class @Deprecated final class UnrecognizedStatementSupport - extends AbstractStatementSupport { + extends AbstractStatementSupport { UnrecognizedStatementSupport(final StatementDefinition publicDefinition) { super(publicDefinition, StatementPolicy.alwaysCopyDeclared()); } @@ -62,18 +62,18 @@ final class UnrecognizedStatementSupport } @Override - protected UnrecognizedStatement createDeclared(final StmtContext ctx, + protected UnrecognizedStatement createDeclared(final StmtContext ctx, final ImmutableList> substatements) { return new UnrecognizedStatementImpl(ctx.rawArgument(), ctx.publicDefinition(), substatements); } @Override - protected UnrecognizedStatement createEmptyDeclared(final StmtContext ctx) { + protected UnrecognizedStatement createEmptyDeclared(final StmtContext ctx) { return createDeclared(ctx, ImmutableList.of()); } @Override - protected UnrecognizedEffectiveStatement createEffective(final Current stmt, + protected UnrecognizedEffectiveStatement createEffective(final Current stmt, final ImmutableList> substatements) { // FIXME: Remove following section after fixing 4380 final UnknownSchemaNode original = (UnknownSchemaNode) stmt.original(); @@ -81,8 +81,8 @@ final class UnrecognizedStatementSupport original == null ? qnameFromArgument(stmt) : original.getQName()); } - private static QName qnameFromArgument(final Current stmt) { - final String value = stmt.argument(); + private static QName qnameFromArgument(final Current stmt) { + final String value = stmt.rawArgument(); if (value == null || value.isEmpty()) { return stmt.publicDefinition().getStatementName(); } diff --git a/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/import_/ImportEffectiveStatementImpl.java b/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/import_/ImportEffectiveStatementImpl.java index 83864f3bb3..45ee9c3f2a 100644 --- a/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/import_/ImportEffectiveStatementImpl.java +++ b/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/import_/ImportEffectiveStatementImpl.java @@ -50,7 +50,7 @@ final class ImportEffectiveStatementImpl extends WithSubstatements> implemen } @Override - public final @NonNull Set argument() { + public final Set argument() { return KeyStatementSupport.unmaskSet(argument); } } diff --git a/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/ordered_by/AbstractOrderedByStatement.java b/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/ordered_by/AbstractOrderedByStatement.java index a0a5e63753..b6749e062f 100644 --- a/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/ordered_by/AbstractOrderedByStatement.java +++ b/yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/ordered_by/AbstractOrderedByStatement.java @@ -23,7 +23,7 @@ abstract class AbstractOrderedByStatement extends AbstractDeclaredStatement } @Override - public final @NonNull Status argument() { + public final Status argument() { return argument; } diff --git a/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/DeclaredStatementsTest.java b/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/DeclaredStatementsTest.java index 6c2be1ff33..12ad6db7d0 100644 --- a/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/DeclaredStatementsTest.java +++ b/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/DeclaredStatementsTest.java @@ -86,11 +86,11 @@ public class DeclaredStatementsTest { assertNotNull(anyxmlSchemaNode); final AnyxmlStatement anyxmlStatement = ((AnyxmlEffectiveStatement) anyxmlSchemaNode).getDeclared(); - final QName name = anyxmlStatement.getName(); + final QName name = anyxmlStatement.argument(); assertNotNull(name); final WhenStatement whenStatement = anyxmlStatement.getWhenStatement().get(); - assertNotNull(whenStatement.getCondition()); + assertNotNull(whenStatement.argument()); final DescriptionStatement whenStatementDescription = whenStatement.getDescription().get(); assertTrue(whenStatement.getReference().isPresent()); @@ -104,7 +104,7 @@ public class DeclaredStatementsTest { assertNotNull(mustStatements); assertEquals(1, mustStatements.size()); final MustStatement mustStatement = mustStatements.iterator().next(); - assertNotNull(mustStatement.getCondition()); + assertNotNull(mustStatement.argument()); assertTrue(mustStatement.getErrorAppTagStatement().isPresent()); assertTrue(mustStatement.getErrorMessageStatement().isPresent()); assertTrue(mustStatement.getDescription().isPresent()); @@ -114,14 +114,14 @@ public class DeclaredStatementsTest { assertFalse(configStatement.getValue()); final StatusStatement statusStatement = anyxmlStatement.getStatus().get(); - final Status status = statusStatement.getValue(); + final Status status = statusStatement.argument(); assertNotNull(status); final DescriptionStatement descriptionStatement = anyxmlStatement.getDescription().get(); - assertEquals("anyxml description", descriptionStatement.getText()); + assertEquals("anyxml description", descriptionStatement.argument()); final ReferenceStatement referenceStatement = anyxmlStatement.getReference().get(); - assertEquals("anyxml reference", referenceStatement.getText()); + assertEquals("anyxml reference", referenceStatement.argument()); assertTrue(anyxmlStatement.getMandatory().isPresent()); } @@ -142,11 +142,11 @@ public class DeclaredStatementsTest { assertNotNull(choiceSchemaNode); final ChoiceStatement choiceStatement = ((ChoiceEffectiveStatement) choiceSchemaNode).getDeclared(); - final QName name = choiceStatement.getName(); + final QName name = choiceStatement.argument(); assertNotNull(name); final DefaultStatement defaultStatement = choiceStatement.getDefault().get(); - assertEquals("case-two", defaultStatement.getValue()); + assertEquals("case-two", defaultStatement.argument()); assertTrue(choiceStatement.getConfig().isPresent()); assertTrue(choiceStatement.getMandatory().isPresent()); @@ -155,7 +155,7 @@ public class DeclaredStatementsTest { assertNotNull(caseStatements); assertEquals(3, caseStatements.size()); final CaseStatement caseStatement = caseStatements.iterator().next(); - final QName caseStatementName = caseStatement.getName(); + final QName caseStatementName = caseStatement.argument(); assertNotNull(caseStatementName); final WhenStatement caseStatementWhen = caseStatement.getWhenStatement().get(); final Collection caseStatementIfFeatures = caseStatement.getIfFeatures(); @@ -198,7 +198,7 @@ public class DeclaredStatementsTest { final AugmentationSchemaNode augmentationSchema = augmentationSchemas.iterator().next(); final AugmentStatement augmentStatement = ((AugmentEffectiveStatement) augmentationSchema).getDeclared(); - final SchemaNodeIdentifier targetNode = augmentStatement.getTargetNode(); + final SchemaNodeIdentifier targetNode = augmentStatement.argument(); assertNotNull(targetNode); final Collection augmentStatementDataDefinitions = @@ -222,25 +222,23 @@ public class DeclaredStatementsTest { assertNotNull(testModule); final ModuleStatement moduleStatement = ((ModuleEffectiveStatement) testModule).getDeclared(); - - final String moduleStatementName = moduleStatement.getName(); - assertNotNull(moduleStatementName); + assertNotNull(moduleStatement.argument()); final YangVersionStatement moduleStatementYangVersion = moduleStatement.getYangVersion(); assertNotNull(moduleStatementYangVersion); - assertNotNull(moduleStatementYangVersion.getValue()); + assertNotNull(moduleStatementYangVersion.argument()); final NamespaceStatement moduleStatementNamspace = moduleStatement.getNamespace(); assertNotNull(moduleStatementNamspace); - assertNotNull(moduleStatementNamspace.getUri()); + assertNotNull(moduleStatementNamspace.argument()); final PrefixStatement moduleStatementPrefix = moduleStatement.getPrefix(); assertNotNull(moduleStatementPrefix); - assertNotNull(moduleStatementPrefix.getValue()); + assertNotNull(moduleStatementPrefix.argument()); assertEquals(1, moduleStatement.getIncludes().size()); final IncludeStatement includeStatement = moduleStatement.getIncludes().iterator().next(); - assertEquals("child-module-declared-test", includeStatement.getModule()); + assertEquals("child-module-declared-test", includeStatement.argument()); final Collection submodules = testModule.getSubmodules(); assertNotNull(submodules); @@ -249,15 +247,14 @@ public class DeclaredStatementsTest { final Submodule submodule = submodules.iterator().next(); final SubmoduleStatement submoduleStatement = ((SubmoduleEffectiveStatement) submodule).getDeclared(); - final String submoduleStatementName = submoduleStatement.getName(); - assertNotNull(submoduleStatementName); + assertNotNull(submoduleStatement.argument()); final YangVersionStatement submoduleStatementYangVersion = submoduleStatement.getYangVersion(); assertNotNull(submoduleStatementYangVersion); final BelongsToStatement belongsToStatement = submoduleStatement.getBelongsTo(); assertNotNull(belongsToStatement); - assertNotNull(belongsToStatement.getModule()); + assertNotNull(belongsToStatement.argument()); assertNotNull(belongsToStatement.getPrefix()); } @@ -280,60 +277,60 @@ public class DeclaredStatementsTest { assertEquals(1, moduleStatement.getImports().size()); final ImportStatement importStatement = moduleStatement.getImports().iterator().next(); - assertEquals("imported-module-declared-test", importStatement.getModule()); - assertEquals("imdt", importStatement.getPrefix().getValue()); - assertEquals(revision, importStatement.getRevisionDate().getDate()); + assertEquals("imported-module-declared-test", importStatement.argument()); + assertEquals("imdt", importStatement.getPrefix().argument()); + assertEquals(revision, importStatement.getRevisionDate().argument()); - 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("test description", moduleStatement.getDescription().get().argument()); + assertEquals("test reference", moduleStatement.getReference().get().argument()); + assertEquals("test organization", moduleStatement.getOrganization().get().argument()); + assertEquals("test contact", moduleStatement.getContact().get().argument()); assertEquals(1, moduleStatement.getRevisions().size()); final RevisionStatement revisionStatement = moduleStatement.getRevisions().iterator().next(); - assertEquals(revision, revisionStatement.getDate()); - assertEquals("test description", revisionStatement.getDescription().get().getText()); - assertEquals("test reference", revisionStatement.getReference().get().getText()); + assertEquals(revision, revisionStatement.argument()); + assertEquals("test description", revisionStatement.getDescription().get().argument()); + assertEquals("test reference", revisionStatement.getReference().get().argument()); assertEquals(1, moduleStatement.getExtensions().size()); final ExtensionStatement extensionStatement = moduleStatement.getExtensions().iterator().next(); - assertEquals(Status.CURRENT, extensionStatement.getStatus().get().getValue()); - assertEquals("test description", extensionStatement.getDescription().get().getText()); - assertEquals("test reference", extensionStatement.getReference().get().getText()); + assertEquals(Status.CURRENT, extensionStatement.getStatus().get().argument()); + assertEquals("test description", extensionStatement.getDescription().get().argument()); + assertEquals("test reference", extensionStatement.getReference().get().argument()); final ArgumentStatement argumentStatement = extensionStatement.getArgument(); - assertEquals("ext-argument", argumentStatement.getName().getLocalName()); - assertTrue(argumentStatement.getYinElement().getValue()); + assertEquals("ext-argument", argumentStatement.argument().getLocalName()); + assertTrue(argumentStatement.getYinElement().argument()); assertEquals(2, moduleStatement.getFeatures().size()); final FeatureStatement featureStatement = moduleStatement.getFeatures().iterator().next(); - 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(Status.CURRENT, featureStatement.getStatus().get().argument()); + assertEquals("test description", featureStatement.getDescription().get().argument()); + assertEquals("test reference", featureStatement.getReference().get().argument()); + assertEquals("test-feature", featureStatement.argument().getLocalName()); assertEquals(1, featureStatement.getIfFeatures().size()); assertEquals(2, moduleStatement.getIdentities().size()); IdentityStatement identityStatement = null; for (final IdentityStatement identity : moduleStatement.getIdentities()) { - if (identity.getName().getLocalName().equals("test-id")) { + if (identity.argument().getLocalName().equals("test-id")) { identityStatement = identity; } } - assertEquals("test-base-id", identityStatement.getBases().iterator().next().getName().getLocalName()); - 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("test-base-id", identityStatement.getBases().iterator().next().argument().getLocalName()); + assertEquals(Status.CURRENT, identityStatement.getStatus().get().argument()); + assertEquals("test description", identityStatement.getDescription().get().argument()); + assertEquals("test reference", identityStatement.getReference().get().argument()); + assertEquals("test-id", identityStatement.argument().getLocalName()); assertEquals(1, moduleStatement.getTypedefs().size()); final TypedefStatement typedefStatement = moduleStatement.getTypedefs().iterator().next(); - 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().get().getName()); + assertEquals(Status.CURRENT, typedefStatement.getStatus().get().argument()); + assertEquals("test description", typedefStatement.getDescription().get().argument()); + assertEquals("test reference", typedefStatement.getReference().get().argument()); + assertEquals("test-typedef", typedefStatement.argument().getLocalName()); + assertEquals("int32", typedefStatement.getType().argument()); + assertEquals("meter", typedefStatement.getUnits().get().argument()); } @Test @@ -353,7 +350,7 @@ public class DeclaredStatementsTest { final ContainerStatement containerStatement = ((ContainerEffectiveStatement) containerSchemaNode).getDeclared(); - final QName name = containerStatement.getName(); + final QName name = containerStatement.argument(); assertNotNull(name); final WhenStatement containerStatementWhen = containerStatement.getWhenStatement().get(); @@ -369,7 +366,7 @@ public class DeclaredStatementsTest { final PresenceStatement containerStatementPresence = containerStatement.getPresence(); assertNotNull(containerStatementPresence); - assertNotNull(containerStatementPresence.getValue()); + assertNotNull(containerStatementPresence.argument()); assertTrue(containerStatement.getConfig().isPresent()); assertTrue(containerStatement.getStatus().isPresent()); diff --git a/yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/AbstractVoidStatementSupport.java b/yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/AbstractEmptyStatementSupport.java similarity index 53% rename from yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/AbstractVoidStatementSupport.java rename to yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/AbstractEmptyStatementSupport.java index c2982763b9..8e30af0437 100644 --- a/yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/AbstractVoidStatementSupport.java +++ b/yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/AbstractEmptyStatementSupport.java @@ -8,20 +8,22 @@ package org.opendaylight.yangtools.yang.parser.spi.meta; import com.google.common.annotations.Beta; +import org.opendaylight.yangtools.yang.common.Empty; 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; @Beta -public abstract class AbstractVoidStatementSupport, - E extends EffectiveStatement> extends AbstractStatementSupport { - protected AbstractVoidStatementSupport(final StatementDefinition publicDefinition, - final StatementPolicy policy) { +public abstract class AbstractEmptyStatementSupport, + E extends EffectiveStatement> extends AbstractStatementSupport { + protected AbstractEmptyStatementSupport(final StatementDefinition publicDefinition, + final StatementPolicy policy) { super(publicDefinition, policy); } @Override - public final Void parseArgumentValue(final StmtContext ctx, final String value) { - return null; + public final Empty parseArgumentValue(final StmtContext ctx, final String value) { + InferenceException.throwIf(value != null, ctx, "Unexpected argument value %s", value); + return Empty.getInstance(); } } -- 2.36.6