Remove AbstractStatementSupport.createEmptyDeclared() 25/95225/2
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 18 Feb 2021 14:05:35 +0000 (15:05 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 18 Feb 2021 14:15:29 +0000 (15:15 +0100)
Checking statements at this level seems to be beneficial, but it is
not, as we end up traveling through additional API layer, which has
to redo the checking. Just remove the method and adjust users.

JIRA: YANGTOOLS-1241
Change-Id: Ic7bf001bc8cb6c4f259e951c9097864f8e423e70
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
93 files changed:
yang/odlext-parser-support/src/main/java/org/opendaylight/yangtools/odlext/parser/AnyxmlSchemaLocationStatementSupport.java
yang/openconfig-parser-support/src/main/java/org/opendaylight/yangtools/openconfig/parser/AbstractHashedValueStatementSupport.java
yang/rfc6241-parser-support/src/main/java/org/opendaylight/yangtools/rfc6241/parser/GetFilterElementAttributesStatementSupport.java
yang/rfc6536-parser-support/src/main/java/org/opendaylight/yangtools/rfc6536/parser/DefaultDenyAllStatementSupport.java
yang/rfc6536-parser-support/src/main/java/org/opendaylight/yangtools/rfc6536/parser/DefaultDenyWriteStatementSupport.java
yang/rfc6643-parser-support/src/main/java/org/opendaylight/yangtools/rfc6643/parser/AliasStatementSupport.java
yang/rfc6643-parser-support/src/main/java/org/opendaylight/yangtools/rfc6643/parser/DefValStatementSupport.java
yang/rfc6643-parser-support/src/main/java/org/opendaylight/yangtools/rfc6643/parser/DisplayHintStatementSupport.java
yang/rfc6643-parser-support/src/main/java/org/opendaylight/yangtools/rfc6643/parser/ImpliedStatementSupport.java
yang/rfc6643-parser-support/src/main/java/org/opendaylight/yangtools/rfc6643/parser/MaxAccessStatementSupport.java
yang/rfc6643-parser-support/src/main/java/org/opendaylight/yangtools/rfc6643/parser/OidStatementSupport.java
yang/rfc6643-parser-support/src/main/java/org/opendaylight/yangtools/rfc6643/parser/SubIdStatementSupport.java
yang/rfc7952-parser-support/src/main/java/org/opendaylight/yangtools/rfc7952/parser/AnnotationStatementSupport.java
yang/rfc8040-parser-support/src/main/java/org/opendaylight/yangtools/rfc8040/parser/YangDataStatementSupport.java
yang/rfc8528-parser-support/src/main/java/org/opendaylight/yangtools/rfc8528/parser/MountPointStatementSupport.java
yang/yang-model-ri/src/main/java/org/opendaylight/yangtools/yang/model/ri/stmt/DeclaredStatements.java
yang/yang-model-ri/src/main/java/org/opendaylight/yangtools/yang/model/ri/stmt/ImplicitStatements.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/openconfig/stmt/OpenConfigVersionSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/augment/AbstractAugmentStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/case_/CaseStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/deviate/AbstractDeviateStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/extension/ExtensionStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/extension/UnrecognizedStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/if_feature/AbstractIfFeatureStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/import_/ImportStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/key/KeyStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/leaf_list/LeafListStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/list/ListStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/ActionStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/AnydataStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/AnyxmlStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/ArgumentStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/BaseStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/BelongsToStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/BitStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/ChoiceStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/ConfigStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/ContainerStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/DefaultStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/DescriptionStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/DeviationStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/EnumStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/ErrorAppTagStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/ErrorMessageStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/FeatureStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/FractionDigitsStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/GroupingStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/IdentityStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/IncludeStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/InputStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/LeafStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/LengthStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/MandatoryStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/MaxElementsStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/ModifierStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/NamespaceStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/OrderedByStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/OutputStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/PositionStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/PrefixStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/PresenceStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/RangeStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/RequireInstanceStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/RevisionDateStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/RevisionStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/RpcStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/StatusStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/TypedefStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/UniqueStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/UnitsStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/WhenStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/YangVersionStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/meta/YinElementStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/module/ModuleStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/must/MustStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/notification/AbstractNotificationStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/path/PathStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/pattern/PatternStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/refine/RefineStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/submodule/SubmoduleStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/type/AbstractIdentityRefSpecificationSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/type/AbstractLeafrefSpecificationSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/type/AbstractTypeStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/type/BitsSpecificationSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/type/Decimal64SpecificationSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/type/EnumSpecificationSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/type/InstanceIdentifierSpecificationSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/type/UnionSpecificationSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/uses/UsesStatementSupport.java
yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/thirdparty/plugin/ThirdPartyExtensionSupport.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/AbstractBooleanStatementSupport.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/AbstractInternedStatementSupport.java
yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/AbstractStatementSupport.java

index f138377ce47707e82205e6b6c0615c6ea1ed6f12..1942648d71c7862acd373b640864c2a4fec3511f 100644 (file)
@@ -64,12 +64,6 @@ public final class AnyxmlSchemaLocationStatementSupport
         return new AnyxmlSchemaLocationStatementImpl(ctx.getRawArgument(), ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected AnyxmlSchemaLocationStatement createEmptyDeclared(
-            final StmtContext<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement, ?> ctx) {
-        return createDeclared(ctx, ImmutableList.of());
-    }
-
     @Override
     protected AnyxmlSchemaLocationEffectiveStatement createEffective(
             final Current<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement> stmt,
index 7ae325ff42eb067c5ce3e66aac98e8d543027b8d..ffcb884ee46be6fce6793498f1475cccd499ee4d 100644 (file)
@@ -26,7 +26,6 @@ import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.UnknownEffectiveState
 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.StatementSupport.StatementPolicy;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
 
@@ -103,17 +102,10 @@ abstract class AbstractHashedValueStatementSupport
         return new Declared(getPublicView(), substatements);
     }
 
-    @Override
-    protected final OpenConfigHashedValueStatement createEmptyDeclared(
-            final StmtContext<Empty, OpenConfigHashedValueStatement, ?> ctx) {
-        return createDeclared(ctx, ImmutableList.of());
-    }
-
     @Override
     protected OpenConfigHashedValueEffectiveStatement createEffective(
             final Current<Empty, OpenConfigHashedValueStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         return new Effective(stmt, substatements);
     }
-
 }
index 619ba926e7d0f648c0b89168305b5b3aca7c199a..f12e41cb9dc35f3458815343a5cec08f99571edf 100644 (file)
@@ -106,13 +106,7 @@ public final class GetFilterElementAttributesStatementSupport extends AbstractEm
     protected GetFilterElementAttributesStatement createDeclared(
             final StmtContext<Empty, GetFilterElementAttributesStatement, ?> ctx,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return new Declared(substatements);
-    }
-
-    @Override
-    protected GetFilterElementAttributesStatement createEmptyDeclared(
-            final StmtContext<Empty, GetFilterElementAttributesStatement, ?> ctx) {
-        return Declared.EMPTY;
+        return substatements.isEmpty() ? Declared.EMPTY : new Declared(substatements);
     }
 
     @Override
index 7aae12d6c33eea0e6409111ea106ceca0f9ae463..91eb86a9280918558fb44fa8bf0809ba7ae5ab40 100644 (file)
@@ -89,12 +89,7 @@ public final class DefaultDenyAllStatementSupport
     @Override
     protected DefaultDenyAllStatement createDeclared(final StmtContext<Empty, DefaultDenyAllStatement, ?> ctx,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return new Declared(substatements);
-    }
-
-    @Override
-    protected DefaultDenyAllStatement createEmptyDeclared(final StmtContext<Empty, DefaultDenyAllStatement, ?> ctx) {
-        return Declared.EMPTY;
+        return substatements.isEmpty() ? Declared.EMPTY : new Declared(substatements);
     }
 
     @Override
index 45e152c35afea5bf0de5852ec348cc992ef6ba0d..a3e25a5f3f7a1baa9b970ef999a524bb286c80a0 100644 (file)
@@ -89,13 +89,7 @@ public final class DefaultDenyWriteStatementSupport
     @Override
     protected DefaultDenyWriteStatement createDeclared(final StmtContext<Empty, DefaultDenyWriteStatement, ?> ctx,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return new Declared(substatements);
-    }
-
-    @Override
-    protected DefaultDenyWriteStatement createEmptyDeclared(
-            final StmtContext<Empty, DefaultDenyWriteStatement, ?> ctx) {
-        return Declared.EMPTY;
+        return substatements.isEmpty() ? Declared.EMPTY : new Declared(substatements);
     }
 
     @Override
index 8b54fb41e0d79976a335b6982736eab08936b3be..a6de8823bf5ea49929fe62c2eadb6851353d85a0 100644 (file)
@@ -51,11 +51,6 @@ public final class AliasStatementSupport
         return new AliasStatementImpl(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected AliasStatement createEmptyDeclared(final StmtContext<String, AliasStatement, ?> ctx) {
-        return createDeclared(ctx, ImmutableList.of());
-    }
-
     @Override
     protected AliasEffectiveStatement createEffective(final Current<String, AliasStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index b681af7fe270b82fbe421ebee3db370c21a23de7..0fa00a72ec82c84368a27e7974affbd75ebcdd49 100644 (file)
@@ -45,11 +45,6 @@ public final class DefValStatementSupport
         return new DefValStatementImpl(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected DefValStatement createEmptyDeclared(final StmtContext<String, DefValStatement, ?> ctx) {
-        return createDeclared(ctx, ImmutableList.of());
-    }
-
     @Override
     protected DefValEffectiveStatement createEffective(final Current<String, DefValStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 123e5dced1bd943dbc31a551fa49ed4b01f6af5e..24b30d8028f7285dfece8f5dc9cb12b624041d5c 100644 (file)
@@ -45,11 +45,6 @@ public final class DisplayHintStatementSupport
         return new DisplayHintStatementImpl(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected DisplayHintStatement createEmptyDeclared(final StmtContext<String, DisplayHintStatement, ?> ctx) {
-        return createDeclared(ctx, ImmutableList.of());
-    }
-
     @Override
     protected DisplayHintEffectiveStatement createEffective(final Current<String, DisplayHintStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 8a82b5ed247879e275f64f26784d9d649a5b7f3a..cffda60591e15c4e77aedc136527becf89ff8710 100644 (file)
@@ -45,11 +45,6 @@ public final class ImpliedStatementSupport
         return new ImpliedStatementImpl(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected ImpliedStatement createEmptyDeclared(final StmtContext<String, ImpliedStatement, ?> ctx) {
-        return createDeclared(ctx, ImmutableList.of());
-    }
-
     @Override
     protected ImpliedEffectiveStatement createEffective(final Current<String, ImpliedStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 4ebcf9fb8b0c3657f71600e54cf6b4cc0f2b6551..642b93c62c136b7a67875bc2da72c212fa2fe152 100644 (file)
@@ -62,11 +62,6 @@ public final class MaxAccessStatementSupport
         return new MaxAccessStatementImpl(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected MaxAccessStatement createEmptyDeclared(final StmtContext<MaxAccess, MaxAccessStatement, ?> ctx) {
-        return createDeclared(ctx, ImmutableList.of());
-    }
-
     @Override
     protected MaxAccessEffectiveStatement createEffective(final Current<MaxAccess, MaxAccessStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index df4f046e03d96b04a3df4849022f1bd79a7d37e0..fabc6bba846a4e6f54747000a10c3a0fb9f78a47 100644 (file)
@@ -56,11 +56,6 @@ public final class OidStatementSupport
         return new OidIdStatementImpl(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected OidStatement createEmptyDeclared(final StmtContext<ObjectIdentifier, OidStatement, ?> ctx) {
-        return createDeclared(ctx, ImmutableList.of());
-    }
-
     @Override
     protected OidEffectiveStatement createEffective(final Current<ObjectIdentifier, OidStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 937108869972118c4367a6ca711c49cb63925aac..94a27b21b3bb468d2c5f1655b261fe0d0e0be2e3 100644 (file)
@@ -51,11 +51,6 @@ public final class SubIdStatementSupport
         return new SubIdStatementImpl(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected SubIdStatement createEmptyDeclared(final StmtContext<Uint32, SubIdStatement, ?> ctx) {
-        return createDeclared(ctx, ImmutableList.of());
-    }
-
     @Override
     protected SubIdEffectiveStatement createEffective(final Current<Uint32, SubIdStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index a762dfb4a144bd61e3d3b011be2608b1e1b24771..57ff9db6989fc5961aa97e2b2790072a624c8534 100644 (file)
@@ -146,11 +146,6 @@ public final class AnnotationStatementSupport
         return new Declared(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected AnnotationStatement createEmptyDeclared(final StmtContext<QName, AnnotationStatement, ?> ctx) {
-        return createDeclared(ctx, ImmutableList.of());
-    }
-
     @Override
     protected AnnotationEffectiveStatement createEffective(final Current<QName, AnnotationStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 10f89c37bac95e11b92b0814df7bea33cb4b3065..6902224a5f2beef035d54ce5af0787e9df55cbbb 100644 (file)
@@ -100,11 +100,6 @@ public final class YangDataStatementSupport
         return new Declared(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected YangDataStatement createEmptyDeclared(final StmtContext<String, YangDataStatement, ?> ctx) {
-        return createDeclared(ctx, ImmutableList.of());
-    }
-
     @Override
     protected YangDataEffectiveStatement createEffective(final Current<String, YangDataStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index e53f1136c5e13912fe944957f01692e5ebccc7ce..775a943b627980ab6cf3e5f97ccc425116b8888e 100644 (file)
@@ -96,11 +96,6 @@ public final class MountPointStatementSupport
         return new Declared(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected MountPointStatement createEmptyDeclared(final StmtContext<QName, MountPointStatement, ?> ctx) {
-        return createDeclared(ctx, ImmutableList.of());
-    }
-
     @Override
     protected MountPointEffectiveStatement createEffective(final Current<QName, MountPointStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 1471789858f61bc77d6e9f3835caf8896904f2ae..6ce0ebd369518a02f6c4b3355ef247c81d4b4bc7 100644 (file)
@@ -237,88 +237,58 @@ public final class DeclaredStatements {
         // Hidden on purpose
     }
 
-    public static ActionStatement createAction(final QName argument) {
-        return new EmptyActionStatement(argument);
-    }
-
     public static ActionStatement createAction(final QName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createAction(argument) : new RegularActionStatement(argument, substatements);
-    }
-
-    public static AnydataStatement createAnydata(final QName argument) {
-        return new EmptyAnydataStatement(argument);
+        return substatements.isEmpty() ? new EmptyActionStatement(argument)
+            : new RegularActionStatement(argument, substatements);
     }
 
     public static AnydataStatement createAnydata(final QName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createAnydata(argument) : new RegularAnydataStatement(argument, substatements);
-    }
-
-    public static AnyxmlStatement createAnyxml(final QName argument) {
-        return new EmptyAnyxmlStatement(argument);
+        return substatements.isEmpty() ? new EmptyAnydataStatement(argument)
+            : new RegularAnydataStatement(argument, substatements);
     }
 
     public static AnyxmlStatement createAnyxml(final QName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createAnyxml(argument) : new RegularAnyxmlStatement(argument, substatements);
-    }
-
-    public static ArgumentStatement createArgument(final QName argument) {
-        return new EmptyArgumentStatement(argument);
+        return substatements.isEmpty() ? new EmptyAnyxmlStatement(argument)
+            : new RegularAnyxmlStatement(argument, substatements);
     }
 
     public static ArgumentStatement createArgument(final QName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createArgument(argument)
+        return substatements.isEmpty() ? new EmptyArgumentStatement(argument)
             : new RegularArgumentStatement(argument, substatements);
     }
 
-    public static AugmentStatement createAugment(final String rawArgument, final SchemaNodeIdentifier argument) {
-        return new EmptyAugmentStatement(rawArgument, argument);
-    }
-
     public static AugmentStatement createAugment(final String rawArgument, final SchemaNodeIdentifier argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createAugment(rawArgument, argument)
+        return substatements.isEmpty() ? new EmptyAugmentStatement(rawArgument, argument)
             : new RegularAugmentStatement(rawArgument, argument, substatements);
     }
 
-    public static BaseStatement createBase(final QName argument) {
-        return new EmptyBaseStatement(argument);
-    }
-
     public static BaseStatement createBase(final QName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createBase(argument) : new RegularBaseStatement(argument, substatements);
-    }
-
-    public static BelongsToStatement createBelongsTo(final String argument) {
-        return new EmptyBelongsToStatement(argument);
+        return substatements.isEmpty() ? new EmptyBaseStatement(argument)
+            : new RegularBaseStatement(argument, substatements);
     }
 
     public static BelongsToStatement createBelongsTo(final String argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createBelongsTo(argument)
+        return substatements.isEmpty() ? new EmptyBelongsToStatement(argument)
             : new RegularBelongsToStatement(argument, substatements);
     }
 
-    public static BitStatement createBit(final String argument) {
-        return new EmptyBitStatement(argument);
-    }
-
     public static BitStatement createBit(final String argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createBit(argument) : new RegularBitStatement(argument, substatements);
-    }
-
-    public static ChoiceStatement createChoice(final QName argument) {
-        return new EmptyChoiceStatement(argument);
+        return substatements.isEmpty() ? new EmptyBitStatement(argument)
+            : new RegularBitStatement(argument, substatements);
     }
 
     public static ChoiceStatement createChoice(final QName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createChoice(argument) : new RegularChoiceStatement(argument, substatements);
+        return substatements.isEmpty() ? new EmptyChoiceStatement(argument)
+            : new RegularChoiceStatement(argument, substatements);
     }
 
     public static ConfigStatement createConfig(final boolean argument) {
@@ -339,103 +309,63 @@ public final class DeclaredStatements {
         return substatements.isEmpty() ? createContact(argument) : new RegularContactStatement(argument, substatements);
     }
 
-    public static ContainerStatement createContainer(final QName argument) {
-        return new EmptyContainerStatement(argument);
-    }
-
     public static ContainerStatement createContainer(final QName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createContainer(argument)
+        return substatements.isEmpty() ? new EmptyContainerStatement(argument)
             : new RegularContainerStatement(argument, substatements);
     }
 
-    public static DefaultStatement createDefault(final String argument) {
-        return new EmptyDefaultStatement(argument);
-    }
-
     public static DefaultStatement createDefault(final String argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createDefault(argument) : new RegularDefaultStatement(argument, substatements);
-    }
-
-    public static DescriptionStatement createDescription(final String argument) {
-        return new EmptyDescriptionStatement(argument);
+        return substatements.isEmpty() ? new EmptyDefaultStatement(argument)
+            : new RegularDefaultStatement(argument, substatements);
     }
 
     public static DescriptionStatement createDescription(final String argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createDescription(argument)
+        return substatements.isEmpty() ? new EmptyDescriptionStatement(argument)
             : new RegularDescriptionStatement(argument, substatements);
     }
 
-    public static DeviateStatement createDeviate(final DeviateKind argument) {
-        // This is exceedingly unlikely, just reuse the implementation
-        return createDeviate(argument, ImmutableList.of());
-    }
-
     public static DeviateStatement createDeviate(final DeviateKind argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
         return new DeviateStatementImpl(argument, substatements);
     }
 
-    public static DeviationStatement createDeviation(final String rawArgument, final Absolute argument) {
-        // This does not make really sense
-        return createDeviation(rawArgument, argument, ImmutableList.of());
-    }
-
     public static DeviationStatement createDeviation(final String rawArgument, final Absolute argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
         return new DeviationStatementImpl(rawArgument, argument, substatements);
     }
 
     // FIXME: what is the distinction between rawArgument and argument?
-    public static EnumStatement createEnum(final String rawArgument, final String argument) {
-        return new EmptyEnumStatement(rawArgument, argument);
-    }
-
     public static EnumStatement createEnum(final String rawArgument, final String argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createEnum(rawArgument, argument)
+        return substatements.isEmpty() ? new EmptyEnumStatement(rawArgument, argument)
             : new RegularEnumStatement(rawArgument, argument, substatements);
     }
 
-    public static ErrorAppTagStatement createErrorAppTag(final String argument) {
-        return new EmptyErrorAppTagStatement(argument);
-    }
-
     public static ErrorAppTagStatement createErrorAppTag(final String argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createErrorAppTag(argument)
+        return substatements.isEmpty() ? new EmptyErrorAppTagStatement(argument)
             : new RegularErrorAppTagStatement(argument, substatements);
     }
 
-    public static ErrorMessageStatement createErrorMessage(final String argument) {
-        return new EmptyErrorMessageStatement(argument);
-    }
-
     public static ErrorMessageStatement createErrorMessage(final String argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createErrorMessage(argument)
+        return substatements.isEmpty() ? new EmptyErrorMessageStatement(argument)
             : new RegularErrorMessageStatement(argument, substatements);
     }
 
-    public static ExtensionStatement createExtension(final QName argument) {
-        return new EmptyExtensionStatement(argument);
-    }
-
     public static ExtensionStatement createExtension(final QName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createExtension(argument)
+        return substatements.isEmpty() ? new EmptyExtensionStatement(argument)
             : new RegularExtensionStatement(argument, substatements);
     }
 
-    public static FeatureStatement createFeature(final QName argument) {
-        return new EmptyFeatureStatement(argument);
-    }
-
     public static FeatureStatement createFeature(final QName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createFeature(argument) : new RegularFeatureStatement(argument, substatements);
+        return substatements.isEmpty() ? new EmptyFeatureStatement(argument)
+            : new RegularFeatureStatement(argument, substatements);
     }
 
     public static FractionDigitsStatement createFractionDigits(final int argument) {
@@ -448,53 +378,32 @@ public final class DeclaredStatements {
             : new RegularFractionDigitsStatement(argument, substatements);
     }
 
-    public static GroupingStatement createGrouping(final QName argument) {
-        return new EmptyGroupingStatement(argument);
-    }
-
     public static GroupingStatement createGrouping(final QName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createGrouping(argument)
+        return substatements.isEmpty() ? new EmptyGroupingStatement(argument)
             : new RegularGroupingStatement(argument, substatements);
     }
 
-    public static IdentityStatement createIdentity(final QName argument) {
-        return new EmptyIdentityStatement(argument);
-    }
-
     public static IdentityStatement createIdentity(final QName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createIdentity(argument)
+        return substatements.isEmpty() ? new EmptyIdentityStatement(argument)
             : new RegularIdentityStatement(argument, substatements);
     }
 
-    public static IfFeatureStatement createIfFeature(final String rawArgument, final IfFeatureExpr argument) {
-        return new EmptyIfFeatureStatement(rawArgument, argument);
-    }
-
     public static IfFeatureStatement createIfFeature(final String rawArgument, final IfFeatureExpr argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createIfFeature(rawArgument, argument)
+        return substatements.isEmpty() ? new EmptyIfFeatureStatement(rawArgument, argument)
             : new RegularIfFeatureStatement(rawArgument, argument, substatements);
     }
 
-    public static ImportStatement createImport(final String argument) {
-        // This should never happen
-        return createImport(argument, ImmutableList.of());
-    }
-
     public static ImportStatement createImport(final String argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
         return new ImportStatementImpl(argument, substatements);
     }
 
-    public static IncludeStatement createInclude(final String rawArgument, final String argument) {
-        return new EmptyIncludeStatement(rawArgument, argument);
-    }
-
     public static IncludeStatement createInclude(final String rawArgument, final String argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createInclude(rawArgument, argument)
+        return substatements.isEmpty() ? new EmptyIncludeStatement(rawArgument, argument)
             : new RegularIncludeStatement(rawArgument, argument, substatements);
     }
 
@@ -507,52 +416,34 @@ public final class DeclaredStatements {
         return substatements.isEmpty() ? createInput(argument) : new RegularInputStatement(argument, substatements);
     }
 
-    public static KeyStatement createKey(final String rawArgument, final Set<QName> argument) {
-        return new EmptyKeyStatement(rawArgument, argument);
-    }
-
     public static KeyStatement createKey(final String rawArgument, final Set<QName> argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createKey(rawArgument, argument)
+        return substatements.isEmpty() ? new EmptyKeyStatement(rawArgument, argument)
             : new RegularKeyStatement(rawArgument, argument, substatements);
     }
 
-    public static LeafStatement createLeaf(final QName argument) {
-        return new EmptyLeafStatement(argument);
-    }
-
     public static LeafStatement createLeaf(final QName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createLeaf(argument) : new RegularLeafStatement(argument, substatements);
-    }
-
-    public static LeafListStatement createLeafList(final QName argument) {
-        return new EmptyLeafListStatement(argument);
+        return substatements.isEmpty() ? new EmptyLeafStatement(argument)
+            : new RegularLeafStatement(argument, substatements);
     }
 
     public static LeafListStatement createLeafList(final QName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createLeafList(argument)
+        return substatements.isEmpty() ? new EmptyLeafListStatement(argument)
             : new RegularLeafListStatement(argument, substatements);
     }
 
-    public static LengthStatement createLength(final String rawArgument, final List<ValueRange> argument) {
-        return new EmptyLengthStatement(rawArgument, argument);
-    }
-
     public static LengthStatement createLength(final String rawArgument, final List<ValueRange> argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createLength(rawArgument, argument)
+        return substatements.isEmpty() ? new EmptyLengthStatement(rawArgument, argument)
             : new RegularLengthStatement(rawArgument, argument, substatements);
     }
 
-    public static ListStatement createList(final QName argument) {
-        return new EmptyListStatement(argument);
-    }
-
     public static ListStatement createList(final QName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createList(argument) : new RegularListStatement(argument, substatements);
+        return substatements.isEmpty() ? new EmptyListStatement(argument)
+            : new RegularListStatement(argument, substatements);
     }
 
     public static MandatoryStatement createMandatory(final Boolean argument) {
@@ -565,13 +456,9 @@ public final class DeclaredStatements {
             : new RegularMandatoryStatement(argument, substatements);
     }
 
-    public static MaxElementsStatement createMaxElements(final String rawArgument, final String argument) {
-        return new EmptyMaxElementsStatement(rawArgument, argument);
-    }
-
     public static MaxElementsStatement createMaxElements(final String rawArgument, final String argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createMaxElements(rawArgument, argument)
+        return substatements.isEmpty() ? new EmptyMaxElementsStatement(rawArgument, argument)
             : new RegularMaxElementsStatement(rawArgument, argument, substatements);
     }
 
@@ -585,13 +472,9 @@ public final class DeclaredStatements {
             : new RegularMinElementsStatement(argument, substatements);
     }
 
-    public static ModifierStatement createModifier(final ModifierKind argument) {
-        return new EmptyModifierStatement(argument);
-    }
-
     public static ModifierStatement createModifier(final ModifierKind argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createModifier(argument)
+        return substatements.isEmpty() ? new EmptyModifierStatement(argument)
             : new RegularModifierStatement(argument, substatements);
     }
 
@@ -600,33 +483,21 @@ public final class DeclaredStatements {
         return new ModuleStatementImpl(rawArgument, argument, substatements);
     }
 
-    public static MustStatement createMust(final String rawArgument, final QualifiedBound argument) {
-        return new EmptyMustStatement(rawArgument, argument);
-    }
-
     public static MustStatement createMust(final String rawArgument, final QualifiedBound argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createMust(rawArgument, argument)
+        return substatements.isEmpty() ? new EmptyMustStatement(rawArgument, argument)
             : new RegularMustStatement(rawArgument, argument, substatements);
     }
 
-    public static NamespaceStatement createNamespace(final XMLNamespace argument) {
-        return new EmptyNamespaceStatement(argument);
-    }
-
     public static NamespaceStatement createNamespace(final XMLNamespace argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createNamespace(argument)
+        return substatements.isEmpty() ? new EmptyNamespaceStatement(argument)
             : new RegularNamespaceStatement(argument, substatements);
     }
 
-    public static NotificationStatement createNotification(final QName argument) {
-        return new EmptyNotificationStatement(argument);
-    }
-
     public static NotificationStatement createNotification(final QName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createNotification(argument)
+        return substatements.isEmpty() ? new EmptyNotificationStatement(argument)
             : new RegularNotificationStatement(argument, substatements);
     }
 
@@ -659,51 +530,33 @@ public final class DeclaredStatements {
             : new RegularOrderedByStatement(argument, substatements);
     }
 
-    public static PathStatement createPath(final PathExpression argument) {
-        return new EmptyPathStatement(argument);
-    }
-
     public static PathStatement createPath(final PathExpression argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createPath(argument) : new RegularPathStatement(argument, substatements);
-    }
-
-    public static PatternStatement createPattern(final PatternExpression argument) {
-        return new EmptyPatternStatement(argument);
+        return substatements.isEmpty() ? new EmptyPathStatement(argument)
+            : new RegularPathStatement(argument, substatements);
     }
 
     public static PatternStatement createPattern(final PatternExpression argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createPattern(argument)
+        return substatements.isEmpty() ? new EmptyPatternStatement(argument)
             : new RegularPatternStatement(argument, substatements);
     }
 
-    public static PositionStatement createPosition(final Uint32 argument) {
-        return new EmptyPositionStatement(argument);
-    }
-
     public static PositionStatement createPosition(final Uint32 argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createPosition(argument)
+        return substatements.isEmpty() ? new EmptyPositionStatement(argument)
             : new RegularPositionStatement(argument, substatements);
     }
 
-    public static PrefixStatement createPrefix(final String argument) {
-        return new EmptyPrefixStatement(argument);
-    }
-
     public static PrefixStatement createPrefix(final String argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createPrefix(argument) : new RegularPrefixStatement(argument, substatements);
-    }
-
-    public static PresenceStatement createPresence(final String argument) {
-        return new EmptyPresenceStatement(argument);
+        return substatements.isEmpty() ? new EmptyPrefixStatement(argument)
+            : new RegularPrefixStatement(argument, substatements);
     }
 
     public static PresenceStatement createPresence(final String argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createPresence(argument)
+        return substatements.isEmpty() ? new EmptyPresenceStatement(argument)
             : new RegularPresenceStatement(argument, substatements);
     }
 
@@ -717,65 +570,49 @@ public final class DeclaredStatements {
             : new RegularReferenceStatement(argument, substatements);
     }
 
-    public static RangeStatement createRange(final String rawArgument, final List<ValueRange> argument) {
-        return new EmptyRangeStatement(rawArgument, argument);
-    }
-
     public static RangeStatement createRange(final String rawArgument, final List<ValueRange> argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createRange(rawArgument, argument)
+        return substatements.isEmpty() ? new EmptyRangeStatement(rawArgument, argument)
             : new RegularRangeStatement(rawArgument, argument, substatements);
     }
 
-    public static RefineStatement createRefine(final String rawArgument, final Descendant argument) {
-        return createRefine(rawArgument, argument, ImmutableList.of());
-    }
-
     public static RefineStatement createRefine(final String rawArgument, final Descendant argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
         return new RefineStatementImpl(rawArgument, argument, substatements);
     }
 
-    public static RequireInstanceStatement createRequireInstance(final boolean argument) {
-        return argument ? EmptyRequireInstanceStatement.TRUE : EmptyRequireInstanceStatement.FALSE;
-    }
-
     public static RequireInstanceStatement createRequireInstance(final Boolean argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createRequireInstance(argument)
-            : new RegularRequireInstanceStatement(argument, substatements);
-    }
-
-    public static RevisionStatement createRevision(final Revision argument) {
-        return new EmptyRevisionStatement(argument);
+        if (substatements.isEmpty()) {
+            return argument ? EmptyRequireInstanceStatement.TRUE : EmptyRequireInstanceStatement.FALSE;
+        }
+        return new RegularRequireInstanceStatement(argument, substatements);
     }
 
     public static RevisionStatement createRevision(final Revision argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createRevision(argument)
+        return substatements.isEmpty() ? new EmptyRevisionStatement(argument)
             : new RegularRevisionStatement(argument, substatements);
     }
 
-    public static RevisionDateStatement createRevisionDate(final Revision argument) {
-        return new EmptyRevisionDateStatement(argument);
-    }
-
     public static RevisionDateStatement createRevisionDate(final Revision argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createRevisionDate(argument)
+        return substatements.isEmpty() ? new EmptyRevisionDateStatement(argument)
             : new RegularRevisionDateStatement(argument, substatements);
     }
 
-    public static RpcStatement createRpc(final QName argument) {
-        return new EmptyRpcStatement(argument);
+    public static RpcStatement createRpc(final QName argument,
+            final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+        return substatements.isEmpty() ? new EmptyRpcStatement(argument)
+            : new RegularRpcStatement(argument, substatements);
     }
 
-    public static RpcStatement createRpc(final QName argument,
+    public static StatusStatement createStatus(final Status argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createRpc(argument) : new RegularRpcStatement(argument, substatements);
+        return substatements.isEmpty() ? createStatus(argument) : new RegularStatusStatement(argument, substatements);
     }
 
-    public static StatusStatement createStatus(final Status argument) {
+    private static StatusStatement createStatus(final Status argument) {
         switch (argument) {
             case CURRENT:
                 return EmptyStatusStatement.CURRENT;
@@ -788,60 +625,38 @@ public final class DeclaredStatements {
         }
     }
 
-    public static StatusStatement createStatus(final Status argument,
-            final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createStatus(argument) : new RegularStatusStatement(argument, substatements);
-    }
-
     public static SubmoduleStatement createSubmodule(final String rawArgument, final UnqualifiedQName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
         return new SubmoduleStatementImpl(rawArgument, argument, substatements);
     }
 
-    public static TypeStatement createType(final String argument) {
-        return new EmptyTypeStatement(argument);
-    }
-
     public static TypeStatement createType(final String argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createType(argument) : new RegularTypeStatement(argument, substatements);
-    }
-
-    public static TypedefStatement createTypedef(final QName argument) {
-        return new EmptyTypedefStatement(argument);
+        return substatements.isEmpty() ? new EmptyTypeStatement(argument)
+            : new RegularTypeStatement(argument, substatements);
     }
 
     public static TypedefStatement createTypedef(final QName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createTypedef(argument) : new RegularTypedefStatement(argument, substatements);
-    }
-
-    public static UniqueStatement createUnique(final String rawArgument, final Set<Descendant> argument) {
-        return new EmptyUniqueStatement(rawArgument, argument);
+        return substatements.isEmpty() ? new EmptyTypedefStatement(argument)
+            : new RegularTypedefStatement(argument, substatements);
     }
 
     public static UniqueStatement createUnique(final String rawArgument, final Set<Descendant> argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createUnique(rawArgument, argument)
+        return substatements.isEmpty() ? new EmptyUniqueStatement(rawArgument, argument)
             : new RegularUniqueStatement(rawArgument, argument, substatements);
     }
 
-    public static UnitsStatement createUnits(final String argument) {
-        return new EmptyUnitsStatement(argument);
-    }
-
     public static UnitsStatement createUnits(final String argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createUnits(argument) : new RegularUnitsStatement(argument, substatements);
-    }
-
-    public static UsesStatement createUses(final String rawArgument, final QName argument) {
-        return new EmptyUsesStatement(rawArgument, argument);
+        return substatements.isEmpty() ? new EmptyUnitsStatement(argument)
+            : new RegularUnitsStatement(argument, substatements);
     }
 
     public static UsesStatement createUses(final String rawArgument, final QName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createUses(rawArgument, argument)
+        return substatements.isEmpty() ?  new EmptyUsesStatement(rawArgument, argument)
             : new RegularUsesStatement(rawArgument, argument, substatements);
     }
 
@@ -854,17 +669,19 @@ public final class DeclaredStatements {
         return substatements.isEmpty() ? createValue(argument) : new RegularValueStatement(argument, substatements);
     }
 
-    public static WhenStatement createWhen(final String rawArgument, final QualifiedBound argument) {
-        return new EmptyWhenStatement(rawArgument, argument);
-    }
-
     public static WhenStatement createWhen(final String rawArgument, final QualifiedBound argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createWhen(rawArgument, argument)
+        return substatements.isEmpty() ? new EmptyWhenStatement(rawArgument, argument)
             : new RegularWhenStatement(rawArgument, argument, substatements);
     }
 
-    public static YangVersionStatement createYangVersion(final YangVersion argument) {
+    public static YangVersionStatement createYangVersion(final YangVersion argument,
+            final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+        return substatements.isEmpty() ? createYangVersion(argument)
+            : new RegularYangVersionStatement(argument, substatements);
+    }
+
+    private static YangVersionStatement createYangVersion(final YangVersion argument) {
         switch (argument) {
             case VERSION_1:
                 return EmptyYangVersionStatement.VERSION_1;
@@ -875,12 +692,6 @@ public final class DeclaredStatements {
         }
     }
 
-    public static YangVersionStatement createYangVersion(final YangVersion argument,
-            final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createYangVersion(argument)
-            : new RegularYangVersionStatement(argument, substatements);
-    }
-
     public static YinElementStatement createYinElement(final boolean argument) {
         return argument ? EmptyYinElementStatement.TRUE : EmptyYinElementStatement.FALSE;
     }
index f625cd31ea1a9f89b30cdf595a986e8d1b4032a2..219289f688b32d3f03bfedc2cc59894dd466a5ac 100644 (file)
@@ -30,23 +30,15 @@ public final class ImplicitStatements {
         // Hidden on purpose
     }
 
-    public static InputStatement createInput(final QName argument) {
-        return new EmptyUndeclaredInputStatement(argument);
-    }
-
     public static InputStatement createInput(final QName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createInput(argument)
+        return substatements.isEmpty() ? new EmptyUndeclaredInputStatement(argument)
             : new RegularUndeclaredInputStatement(argument, substatements);
     }
 
-    public static OutputStatement createOutput(final QName argument) {
-        return new EmptyUndeclaredOutputStatement(argument);
-    }
-
     public static OutputStatement createOutput(final QName argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return substatements.isEmpty() ? createOutput(argument)
+        return substatements.isEmpty() ? new EmptyUndeclaredOutputStatement(argument)
             : new RegularUndeclaredOutputStatement(argument, substatements);
     }
 }
index ca50ced9715aa0152e7767cc6b73e04bf67563dd..eb51f196e505a97cf8d3e92038cbee72e3f9b438 100644 (file)
@@ -57,12 +57,6 @@ public final class OpenConfigVersionSupport
         return new OpenConfigVersionStatementImpl(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected OpenConfigVersionStatement createEmptyDeclared(
-            final StmtContext<SemVer, OpenConfigVersionStatement, ?> ctx) {
-        return createDeclared(ctx, ImmutableList.of());
-    }
-
     @Override
     protected OpenConfigVersionEffectiveStatement createEffective(
             final Current<SemVer, OpenConfigVersionStatement> stmt,
index 83101786e491469ae30181c2ca11dbc57d5d5959..38f54d281c2014522c1f5a04357dcc9db1ef5973 100644 (file)
@@ -112,12 +112,6 @@ abstract class AbstractAugmentStatementSupport
         return DeclaredStatements.createAugment(ctx.getRawArgument(), ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected final AugmentStatement createEmptyDeclared(
-            final StmtContext<SchemaNodeIdentifier, AugmentStatement, ?> ctx) {
-        return DeclaredStatements.createAugment(ctx.getRawArgument(), ctx.getArgument());
-    }
-
     @Override
     protected final List<? extends StmtContext<?, ?, ?>> statementsToBuild(
             final Current<SchemaNodeIdentifier, AugmentStatement> stmt,
index 8fdf76839600d3829dfe34d4a88c9b75da696ffe..0e78d8abb704a5eec420a0a2e64522679ce26cd3 100644 (file)
@@ -95,26 +95,24 @@ public final class CaseStatementSupport
     protected CaseStatement createDeclared(final StmtContext<QName, CaseStatement, ?> ctx,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
         final StatementSource source = ctx.source();
-        switch (source) {
-            case CONTEXT:
-                return new RegularUndeclaredCaseStatement(ctx.getArgument(), substatements);
-            case DECLARATION:
-                return new RegularCaseStatement(ctx.getArgument(), substatements);
-            default:
-                throw new IllegalStateException("Unhandled statement source " + source);
-        }
-    }
-
-    @Override
-    protected CaseStatement createEmptyDeclared(final StmtContext<QName, CaseStatement, ?> ctx) {
-        final StatementSource source = ctx.source();
-        switch (source) {
-            case CONTEXT:
-                return new EmptyUndeclaredCaseStatement(ctx.getArgument());
-            case DECLARATION:
-                return new EmptyCaseStatement(ctx.getArgument());
-            default:
-                throw new IllegalStateException("Unhandled statement source " + source);
+        if (substatements.isEmpty()) {
+            switch (source) {
+                case CONTEXT:
+                    return new EmptyUndeclaredCaseStatement(ctx.getArgument());
+                case DECLARATION:
+                    return new EmptyCaseStatement(ctx.getArgument());
+                default:
+                    throw new IllegalStateException("Unhandled statement source " + source);
+            }
+        } else {
+            switch (source) {
+                case CONTEXT:
+                    return new RegularUndeclaredCaseStatement(ctx.getArgument(), substatements);
+                case DECLARATION:
+                    return new RegularCaseStatement(ctx.getArgument(), substatements);
+                default:
+                    throw new IllegalStateException("Unhandled statement source " + source);
+            }
         }
     }
 
index 1354830905d231256644cb2467b08bf8ba2e3497..0c7edc78b4879790d98f2206019859fa320882ba 100644 (file)
@@ -196,11 +196,6 @@ abstract class AbstractDeviateStatementSupport
         return DeclaredStatements.createDeviate(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected final DeviateStatement createEmptyDeclared(final StmtContext<DeviateKind, DeviateStatement, ?> ctx) {
-        return DeclaredStatements.createDeviate(ctx.getArgument());
-    }
-
     @Override
     protected final DeviateEffectiveStatement createEffective(final Current<DeviateKind, DeviateStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 2eddb477fe74b382a85c95d73e9d9412b471a725..a5b925706e3f2c802bf203e1f3520eb4ed75585f 100644 (file)
@@ -85,11 +85,6 @@ public final class ExtensionStatementSupport
         return DeclaredStatements.createExtension(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected ExtensionStatement createEmptyDeclared(final StmtContext<QName, ExtensionStatement, ?> ctx) {
-        return DeclaredStatements.createExtension(ctx.getArgument());
-    }
-
     @Override
     protected ExtensionEffectiveStatement createEffective(final Current<QName, ExtensionStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 2101168110adc3e4c0e544d23117f4ac0734c779..d092c896c1e09746b4f3b3160102a9ba7333c841 100644 (file)
@@ -65,11 +65,6 @@ final class UnrecognizedStatementSupport
         return new UnrecognizedStatementImpl(ctx.rawArgument(), ctx.publicDefinition(), substatements);
     }
 
-    @Override
-    protected UnrecognizedStatement createEmptyDeclared(final StmtContext<Object, UnrecognizedStatement, ?> ctx) {
-        return createDeclared(ctx, ImmutableList.of());
-    }
-
     // createEffective() should never be called, ensure that for each declared statement
 
     @Override
index ff58fca115dd6c68255d900469c0bbb97aa5523b..a690334d3b5f8be5c7058b2dd4bc2558028bb0bc 100644 (file)
@@ -92,12 +92,6 @@ abstract class AbstractIfFeatureStatementSupport
         return DeclaredStatements.createIfFeature(ctx.getRawArgument(), ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected final IfFeatureStatement createEmptyDeclared(
-            final StmtContext<IfFeatureExpr, IfFeatureStatement, ?> ctx) {
-        return DeclaredStatements.createIfFeature(ctx.getRawArgument(), ctx.getArgument());
-    }
-
     @Override
     protected final IfFeatureEffectiveStatement createEffective(final Current<IfFeatureExpr, IfFeatureStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 250fc3fe65c7ca261c297c1c112797d8b3252cfc..062c99438d53718c10c50f96191bda2128e7c8f4 100644 (file)
@@ -133,11 +133,6 @@ public final class ImportStatementSupport
         return DeclaredStatements.createImport(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected ImportStatement createEmptyDeclared(final StmtContext<String, ImportStatement, ?> ctx) {
-        return DeclaredStatements.createImport(ctx.getRawArgument());
-    }
-
     @Override
     protected ImportEffectiveStatement createEffective(final Current<String, ImportStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index e7a3f7728021f416285869886c8326fe32f94c65..3f4b5cf66df033ea0ebf5bfaa0ef0a8881b57a63 100644 (file)
@@ -114,11 +114,6 @@ public final class KeyStatementSupport
         return DeclaredStatements.createKey(ctx.getRawArgument(), ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected KeyStatement createEmptyDeclared(final StmtContext<Set<QName>, KeyStatement, ?> ctx) {
-        return DeclaredStatements.createKey(ctx.getRawArgument(), ctx.getArgument());
-    }
-
     @Override
     protected KeyEffectiveStatement createEffective(final Current<Set<QName>, KeyStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 3fd09a8d29156d5fa6bd037951f8942b630b8c59..58c31c750c26ff38060bbe99421302cbba744a03 100644 (file)
@@ -100,11 +100,6 @@ public final class LeafListStatementSupport
         return DeclaredStatements.createLeafList(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected LeafListStatement createEmptyDeclared(final StmtContext<QName, LeafListStatement, ?> ctx) {
-        return DeclaredStatements.createLeafList(ctx.getArgument());
-    }
-
     @Override
     public LeafListEffectiveStatement copyEffective(final Current<QName, LeafListStatement> stmt,
             final LeafListEffectiveStatement original) {
index d8ae375a413f923315151be1205b9dee956cddc9..629b500ecee0e81fd43d587c19d7440cf4d8d8be 100644 (file)
@@ -139,11 +139,6 @@ public final class ListStatementSupport
         return DeclaredStatements.createList(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected ListStatement createEmptyDeclared(final StmtContext<QName, ListStatement, ?> ctx) {
-        return DeclaredStatements.createList(ctx.getArgument());
-    }
-
     @Override
     public ListEffectiveStatement copyEffective(final Current<QName, ListStatement> stmt,
             final ListEffectiveStatement original) {
index 1532bc96eda27caef52c4e0b1c466df5e00327bd..d88f5c6a6fa69f869d203c4e219e25a6b76b87da 100644 (file)
@@ -101,11 +101,6 @@ public final class ActionStatementSupport extends
         return DeclaredStatements.createAction(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected ActionStatement createEmptyDeclared(final StmtContext<QName, ActionStatement, ?> ctx) {
-        return DeclaredStatements.createAction(ctx.getArgument());
-    }
-
     @Override
     protected ActionEffectiveStatement createEffective(final Current<QName, ActionStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index c38c68c7ee8f58da43ff6b5a06a1057f7aa18e57..7df1513a76901b9d973a717a17ff842a64f6d66f 100644 (file)
@@ -61,11 +61,6 @@ public final class AnydataStatementSupport
         return DeclaredStatements.createAnydata(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected AnydataStatement createEmptyDeclared(final StmtContext<QName, AnydataStatement, ?> ctx) {
-        return DeclaredStatements.createAnydata(ctx.getArgument());
-    }
-
     @Override
     protected AnydataEffectiveStatement createEffective(final Current<QName, AnydataStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 5541245b8f0017646fd6592988970534bbabf476..5248afbf7b8a2752d3cc37963aaf752cf2d7e815 100644 (file)
@@ -61,11 +61,6 @@ public final class AnyxmlStatementSupport
         return DeclaredStatements.createAnyxml(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected AnyxmlStatement createEmptyDeclared(final StmtContext<QName, AnyxmlStatement, ?> ctx) {
-        return DeclaredStatements.createAnyxml(ctx.getArgument());
-    }
-
     @Override
     protected AnyxmlEffectiveStatement createEffective(final Current<QName, AnyxmlStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 2481d68ce4e9a00b78b3aca158766555b2d9e3f2..ae6b798375bacf502382878b09e1527bda82e4b3 100644 (file)
@@ -54,11 +54,6 @@ public final class ArgumentStatementSupport
         return DeclaredStatements.createArgument(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected ArgumentStatement createEmptyDeclared(final StmtContext<QName, ArgumentStatement, ?> ctx) {
-        return DeclaredStatements.createArgument(ctx.getArgument());
-    }
-
     @Override
     protected ArgumentEffectiveStatement createEffective(final Current<QName, ArgumentStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index e244a8b69ace162eb9adec15f5f505e42f34c55a..c0efea9846708026e8b01918747821621ba9ddcd 100644 (file)
@@ -87,11 +87,6 @@ public final class BaseStatementSupport extends AbstractQNameStatementSupport<Ba
         return DeclaredStatements.createBase(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected BaseStatement createEmptyDeclared(final StmtContext<QName, BaseStatement, ?> ctx) {
-        return DeclaredStatements.createBase(ctx.getArgument());
-    }
-
     @Override
     protected BaseEffectiveStatement createEffective(final Current<QName, BaseStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 70aaf555d866889e7d34d957401d2001f9e7cc2a..410797fd4bed03a64bc9f5033c8e3aba1823b9b2 100644 (file)
@@ -90,11 +90,6 @@ public final class BelongsToStatementSupport
         return DeclaredStatements.createBelongsTo(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected BelongsToStatement createEmptyDeclared(final StmtContext<String, BelongsToStatement, ?> ctx) {
-        return DeclaredStatements.createBelongsTo(ctx.getRawArgument());
-    }
-
     @Override
     protected BelongsToEffectiveStatement createEffective(final Current<String, BelongsToStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index bb666101134aee1ec1a0776b7ff55e27019dcf32..d71163d9348f164c95751913a5524937ac8b443c 100644 (file)
@@ -75,11 +75,6 @@ public final class BitStatementSupport extends AbstractStatementSupport<String,
         return DeclaredStatements.createBit(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected BitStatement createEmptyDeclared(final StmtContext<String, BitStatement, ?> ctx) {
-        return DeclaredStatements.createBit(ctx.getArgument());
-    }
-
     @Override
     protected BitEffectiveStatement createEffective(final Current<String, BitStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index f328676517c6e32e7119d91970aa2dee40acb575..36211e9a72cca3bf6974025b96c2fc1cb80b297d 100644 (file)
@@ -119,11 +119,6 @@ public final class ChoiceStatementSupport
         return DeclaredStatements.createChoice(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected ChoiceStatement createEmptyDeclared(@NonNull final StmtContext<QName, ChoiceStatement, ?> ctx) {
-        return DeclaredStatements.createChoice(ctx.getArgument());
-    }
-
     @Override
     public ChoiceEffectiveStatement copyEffective(final Current<QName, ChoiceStatement> stmt,
             final ChoiceEffectiveStatement original) {
index ab538b153d075487099e0f5f7c1f6b73d45d2f6a..91ee45db9478b2c200e4c68d6f711e3f7cdc2681 100644 (file)
@@ -16,7 +16,6 @@ import org.opendaylight.yangtools.yang.model.api.stmt.ConfigStatement;
 import org.opendaylight.yangtools.yang.model.ri.stmt.DeclaredStatements;
 import org.opendaylight.yangtools.yang.model.ri.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractBooleanStatementSupport;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
 
 public final class ConfigStatementSupport
@@ -43,9 +42,9 @@ public final class ConfigStatementSupport
     }
 
     @Override
-    protected ConfigStatement createDeclared(final StmtContext<Boolean, ConfigStatement, ?> ctx,
+    protected ConfigStatement createDeclared(final Boolean argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return DeclaredStatements.createConfig(ctx.getArgument(), substatements);
+        return DeclaredStatements.createConfig(argument, substatements);
     }
 
     @Override
index 4eed68953f309332c985956b3d284f8553ba8ad8..25b8c9195494ee3eb9cf20af0077b14c44bb8fe4 100644 (file)
@@ -108,11 +108,6 @@ public final class ContainerStatementSupport
         return DeclaredStatements.createContainer(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected ContainerStatement createEmptyDeclared(final StmtContext<QName, ContainerStatement, ?> ctx) {
-        return DeclaredStatements.createContainer(ctx.getArgument());
-    }
-
     @Override
     protected ContainerEffectiveStatement createEffective(final Current<QName, ContainerStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 3cc0f91389b2d538b157508715a5c2131dc3d537..7febd16f66f0f88c2a6192a8711665506df5a114 100644 (file)
@@ -46,11 +46,6 @@ public final class DefaultStatementSupport
         return DeclaredStatements.createDefault(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected DefaultStatement createEmptyDeclared(final StmtContext<String, DefaultStatement, ?> ctx) {
-        return DeclaredStatements.createDefault(ctx.getRawArgument());
-    }
-
     @Override
     protected DefaultEffectiveStatement createEffective(final Current<String, DefaultStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 543469a34f0dafb65579a9bad79aab420daad4ce..ac17f9c71a65072eb826fc7267eb29213d546f20 100644 (file)
@@ -45,11 +45,6 @@ public final class DescriptionStatementSupport
         return DeclaredStatements.createDescription(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected DescriptionStatement createEmptyDeclared(final StmtContext<String, DescriptionStatement, ?> ctx) {
-        return DeclaredStatements.createDescription(ctx.getRawArgument());
-    }
-
     @Override
     protected DescriptionEffectiveStatement createEffective(final Current<String, DescriptionStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 5a638f63d1b2921b2306c3813974dc369a14e496..0e90bfb288dccabec00dd7859c263a3742397d42 100644 (file)
@@ -73,11 +73,6 @@ public final class DeviationStatementSupport
         return DeclaredStatements.createDeviation(ctx.getRawArgument(), ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected DeviationStatement createEmptyDeclared(final StmtContext<Absolute, DeviationStatement, ?> ctx) {
-        return DeclaredStatements.createDeviation(ctx.getRawArgument(), ctx.getArgument());
-    }
-
     @Override
     protected DeviationEffectiveStatement createEffective(final Current<Absolute, DeviationStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index d262ce426c808f7a7813b702a383b50e93f80c39..6bd5bdecdc1815c6bdcf45a7ae352980e3b6b994 100644 (file)
@@ -75,11 +75,6 @@ public final class EnumStatementSupport
         return DeclaredStatements.createEnum(ctx.getRawArgument(), ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected EnumStatement createEmptyDeclared(final StmtContext<String, EnumStatement, ?> ctx) {
-        return DeclaredStatements.createEnum(ctx.getRawArgument(), ctx.getArgument());
-    }
-
     @Override
     protected EnumEffectiveStatement createEffective(final Current<String, EnumStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 64905e084ace823a164c62cecc2d84ecedc1bfc5..a7556d72ae61659ca9a3122a2307e90c4d9ccf5a 100644 (file)
@@ -45,11 +45,6 @@ public final class ErrorAppTagStatementSupport
         return DeclaredStatements.createErrorAppTag(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected ErrorAppTagStatement createEmptyDeclared(final StmtContext<String, ErrorAppTagStatement, ?> ctx) {
-        return DeclaredStatements.createErrorAppTag(ctx.getRawArgument());
-    }
-
     @Override
     protected ErrorAppTagEffectiveStatement createEffective(final Current<String, ErrorAppTagStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 5743dc091317150019b4d5571bf0cd28ebcf7e3c..b170b303bff889ee62306312f5ac06cf221bf01b 100644 (file)
@@ -45,11 +45,6 @@ public final class ErrorMessageStatementSupport
         return DeclaredStatements.createErrorMessage(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected ErrorMessageStatement createEmptyDeclared(final StmtContext<String, ErrorMessageStatement, ?> ctx) {
-        return DeclaredStatements.createErrorMessage(ctx.getRawArgument());
-    }
-
     @Override
     protected ErrorMessageEffectiveStatement createEffective(final Current<String, ErrorMessageStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 37e170a2ce736da817a43d1c10decc01f8127675..1e10c6a3117e39e98a977e8105b975f0ab5df9b9 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta;
 
 import com.google.common.collect.ImmutableList;
-import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.Status;
 import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
@@ -69,11 +68,6 @@ public final class FeatureStatementSupport
         return DeclaredStatements.createFeature(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected FeatureStatement createEmptyDeclared(@NonNull final StmtContext<QName, FeatureStatement, ?> ctx) {
-        return DeclaredStatements.createFeature(ctx.getArgument());
-    }
-
     @Override
     protected FeatureEffectiveStatement createEffective(final Current<QName, FeatureStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 70c0c88a0912f56a19b571500ecc9f3c0ec7f13e..0c739cdc443a68aba8a8643af677dc016ba0415c 100644 (file)
@@ -75,11 +75,6 @@ public final class FractionDigitsStatementSupport
         return DeclaredStatements.createFractionDigits(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected FractionDigitsStatement createEmptyDeclared(final StmtContext<Integer, FractionDigitsStatement, ?> ctx) {
-        return DeclaredStatements.createFractionDigits(ctx.getArgument());
-    }
-
     @Override
     protected FractionDigitsEffectiveStatement createEffective(final Current<Integer, FractionDigitsStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 40c427e733949c2f5a73532528e183daca2b3e99..586d431649adbac49464e1930295cdcbe6dc84b3 100644 (file)
@@ -143,11 +143,6 @@ public final class GroupingStatementSupport
         return DeclaredStatements.createGrouping(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected GroupingStatement createEmptyDeclared(final StmtContext<QName, GroupingStatement, ?> ctx) {
-        return DeclaredStatements.createGrouping(ctx.getArgument());
-    }
-
     @Override
     protected GroupingEffectiveStatement createEffective(final Current<QName, GroupingStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index b262f6fba42250c99d24d99f71cf1d68716ed31c..80f86437efbfdc3ca996ebb22a0ebfc0b572322e 100644 (file)
@@ -98,11 +98,6 @@ public final class IdentityStatementSupport
         return DeclaredStatements.createIdentity(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected IdentityStatement createEmptyDeclared(final StmtContext<QName, IdentityStatement, ?> ctx) {
-        return DeclaredStatements.createIdentity(ctx.getArgument());
-    }
-
     @Override
     protected IdentityEffectiveStatement createEffective(final Current<QName, IdentityStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 8d5c788d24f996b807c820354bbe3ae230b6926d..ae186e361087f4cca3076732a7e59fe79ccbfa9f 100644 (file)
@@ -121,11 +121,6 @@ public final class IncludeStatementSupport
         return DeclaredStatements.createInclude(ctx.getRawArgument(), ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected IncludeStatement createEmptyDeclared(final StmtContext<String, IncludeStatement, ?> ctx) {
-        return DeclaredStatements.createInclude(ctx.getRawArgument(), ctx.getArgument());
-    }
-
     @Override
     protected IncludeEffectiveStatement createEffective(final Current<String, IncludeStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index f4a8e340391d50b0ae1d464feef636a0f3a85ab2..ec1a364f1741f871170d88b31343fa4aaacfbadb 100644 (file)
@@ -94,19 +94,6 @@ public final class InputStatementSupport
         }
     }
 
-    @Override
-    protected InputStatement createEmptyDeclared(final StmtContext<QName, InputStatement, ?> ctx) {
-        final StatementSource source = ctx.source();
-        switch (source) {
-            case CONTEXT:
-                return ImplicitStatements.createInput(ctx.getArgument());
-            case DECLARATION:
-                return DeclaredStatements.createInput(ctx.getArgument());
-            default:
-                throw new IllegalStateException("Unhandled statement source " + source);
-        }
-    }
-
     @Override
     protected InputEffectiveStatement copyDeclaredEffective(final int flags,
             final Current<QName, InputStatement> stmt, final InputEffectiveStatement original) {
index 77535e5690774068c1bf809e511e018d8a9017a5..1d0567707fa69a30e1cfb8fa37ea23bd672ec1df 100644 (file)
@@ -76,11 +76,6 @@ public final class LeafStatementSupport
         return DeclaredStatements.createLeaf(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected LeafStatement createEmptyDeclared(final StmtContext<QName, LeafStatement, ?> ctx) {
-        return DeclaredStatements.createLeaf(ctx.getArgument());
-    }
-
     @Override
     public LeafEffectiveStatement copyEffective(final Current<QName, LeafStatement> stmt,
             final LeafEffectiveStatement original) {
index 56ef20ab72755b4f021bc13e706a37278f4f1603..9b458dd3b344d40abb3d3faf28c857f394c24f6e 100644 (file)
@@ -92,11 +92,6 @@ public final class LengthStatementSupport
         return DeclaredStatements.createLength(ctx.getRawArgument(), ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected LengthStatement createEmptyDeclared(final StmtContext<List<ValueRange>, LengthStatement, ?> ctx) {
-        return DeclaredStatements.createLength(ctx.getRawArgument(), ctx.getArgument());
-    }
-
     @Override
     protected LengthEffectiveStatement createEffective(final Current<List<ValueRange>, LengthStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index e6e07be05d6e7e231c622081eb0925ea31029429..69ab4f3e8dc31d9bdcd117f0ffb570e62ecc2bb2 100644 (file)
@@ -16,7 +16,6 @@ import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryStatement;
 import org.opendaylight.yangtools.yang.model.ri.stmt.DeclaredStatements;
 import org.opendaylight.yangtools.yang.model.ri.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractBooleanStatementSupport;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
 
 public final class MandatoryStatementSupport extends
@@ -42,9 +41,9 @@ public final class MandatoryStatementSupport extends
     }
 
     @Override
-    protected MandatoryStatement createDeclared(final StmtContext<Boolean, MandatoryStatement, ?> ctx,
+    protected MandatoryStatement createDeclared(final Boolean argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return DeclaredStatements.createMandatory(ctx.getArgument(), substatements);
+        return DeclaredStatements.createMandatory(argument, substatements);
     }
 
     @Override
index 0fc62f3f6b259f45488154354c993a34c9a57acc..3054ad531f0bcb0f989b92c310b38361ddf14fbe 100644 (file)
@@ -51,11 +51,6 @@ public final class MaxElementsStatementSupport
         return DeclaredStatements.createMaxElements(ctx.getRawArgument(), ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected MaxElementsStatement createEmptyDeclared(final StmtContext<String, MaxElementsStatement, ?> ctx) {
-        return DeclaredStatements.createMaxElements(ctx.getRawArgument(), ctx.getArgument());
-    }
-
     @Override
     protected MaxElementsEffectiveStatement createEffective(final Current<String, MaxElementsStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index ba938f5ade9bd8b3e80c4b687a4670126d17f112..310c4d01cba84294cf73ba0de4c17c9f91aa0f82 100644 (file)
@@ -58,11 +58,6 @@ public final class ModifierStatementSupport
         return DeclaredStatements.createModifier(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected ModifierStatement createEmptyDeclared(final StmtContext<ModifierKind, ModifierStatement, ?> ctx) {
-        return DeclaredStatements.createModifier(ctx.getArgument());
-    }
-
     @Override
     protected ModifierEffectiveStatement createEffective(final Current<ModifierKind, ModifierStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 9317bf641c979f0082f3e86fad3ccb713db5c1cc..b93e5dfbe6c9c8ffc72ea94a41204c26276a946f 100644 (file)
@@ -58,11 +58,6 @@ public final class NamespaceStatementSupport
         return DeclaredStatements.createNamespace(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected NamespaceStatement createEmptyDeclared(final StmtContext<XMLNamespace, NamespaceStatement, ?> ctx) {
-        return DeclaredStatements.createNamespace(ctx.getArgument());
-    }
-
     @Override
     protected NamespaceEffectiveStatement createEffective(final Current<XMLNamespace, NamespaceStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 44e84f8525d110dce41a4e1f86a55b2852e3e89b..7f3ce4ce3a675d13609e99bcf433a3b81b26c48a 100644 (file)
@@ -79,19 +79,18 @@ public final class OrderedByStatementSupport
     @Override
     protected OrderedByStatement createDeclared(final StmtContext<Ordering, OrderedByStatement, ?> ctx,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return DeclaredStatements.createOrderedBy(ctx.getArgument(), substatements);
-    }
-
-    @Override
-    protected OrderedByStatement createEmptyDeclared(final StmtContext<Ordering, OrderedByStatement, ?> ctx) {
-        final Ordering argument = ctx.getArgument();
-        switch (argument) {
-            case SYSTEM:
-                return EMPTY_SYSTEM_DECL;
-            case USER:
-                return EMPTY_USER_DECL;
-            default:
-                throw new IllegalStateException("Unhandled argument " + argument);
+        if (substatements.isEmpty()) {
+            final Ordering argument = ctx.getArgument();
+            switch (argument) {
+                case SYSTEM:
+                    return EMPTY_SYSTEM_DECL;
+                case USER:
+                    return EMPTY_USER_DECL;
+                default:
+                    throw new IllegalStateException("Unhandled argument " + argument);
+            }
+        } else {
+            return DeclaredStatements.createOrderedBy(ctx.getArgument(), substatements);
         }
     }
 
index 6eaed5830bcf50bb27b3339333830245172784d6..cff8b15fde8c2e65e340d4a25cb09f8cbb40c2be 100644 (file)
@@ -94,19 +94,6 @@ public final class OutputStatementSupport
         }
     }
 
-    @Override
-    protected OutputStatement createEmptyDeclared(final StmtContext<QName, OutputStatement, ?> ctx) {
-        final StatementSource source = ctx.source();
-        switch (source) {
-            case CONTEXT:
-                return ImplicitStatements.createOutput(ctx.getArgument());
-            case DECLARATION:
-                return DeclaredStatements.createOutput(ctx.getArgument());
-            default:
-                throw new IllegalStateException("Unhandled statement source " + source);
-        }
-    }
-
     @Override
     protected OutputEffectiveStatement copyDeclaredEffective(final int flags,
             final Current<QName, OutputStatement> stmt, final OutputEffectiveStatement original) {
index 91c0255f6c9b234f85c9f5cfc9abd065d8f306c7..54c044b8199f9ae2fc8257ffeae19b38b958e5bb 100644 (file)
@@ -57,7 +57,7 @@ public final class PositionStatementSupport
 
     @Override
     protected PositionStatement createEmptyDeclared(final Uint32 argument) {
-        return DeclaredStatements.createPosition(argument);
+        return DeclaredStatements.createPosition(argument, ImmutableList.of());
     }
 
     @Override
index f8cc0f4340eb2856a603f2906b96c5093f4d7c3a..62a5c52d516d3d00153b97f6e026d14a7f671770 100644 (file)
@@ -45,11 +45,6 @@ public final class PrefixStatementSupport
         return DeclaredStatements.createPrefix(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected PrefixStatement createEmptyDeclared(final StmtContext<String, PrefixStatement, ?> ctx) {
-        return DeclaredStatements.createPrefix(ctx.getRawArgument());
-    }
-
     @Override
     protected PrefixEffectiveStatement createEffective(final Current<String, PrefixStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 8b5b63071f78a4f54b8ec50ef1720bbe5f9e0c9a..537902afef8bace404b74d2a9ed2ca5cbe209e5e 100644 (file)
@@ -45,11 +45,6 @@ public final class PresenceStatementSupport
         return DeclaredStatements.createPresence(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected PresenceStatement createEmptyDeclared(final StmtContext<String, PresenceStatement, ?> ctx) {
-        return DeclaredStatements.createPresence(ctx.getRawArgument());
-    }
-
     @Override
     protected PresenceEffectiveStatement createEffective(final Current<String, PresenceStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 33da746ad4acdbfd413c16cb6b8e783c59f2917b..6a6067beb892de598845597781b6a944c57758cc 100644 (file)
@@ -88,11 +88,6 @@ public final class RangeStatementSupport
         return DeclaredStatements.createRange(ctx.getRawArgument(), ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected RangeStatement createEmptyDeclared(final StmtContext<List<ValueRange>, RangeStatement, ?> ctx) {
-        return DeclaredStatements.createRange(ctx.getRawArgument(), ctx.getArgument());
-    }
-
     @Override
     protected RangeEffectiveStatement createEffective(final Current<List<ValueRange>, RangeStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 2541cd7baee3a6c525eb32af5daea8f98c0de919..29618230fd1ddde9b4a0dcebbd58625976c98524 100644 (file)
@@ -16,7 +16,6 @@ import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceStatement;
 import org.opendaylight.yangtools.yang.model.ri.stmt.DeclaredStatements;
 import org.opendaylight.yangtools.yang.model.ri.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractBooleanStatementSupport;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
 
 public final class RequireInstanceStatementSupport
@@ -41,9 +40,9 @@ public final class RequireInstanceStatementSupport
     }
 
     @Override
-    protected RequireInstanceStatement createDeclared(final StmtContext<Boolean, RequireInstanceStatement, ?> ctx,
+    protected RequireInstanceStatement createDeclared(final Boolean argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return DeclaredStatements.createRequireInstance(ctx.getArgument(), substatements);
+        return DeclaredStatements.createRequireInstance(argument, substatements);
     }
 
     @Override
index 1055e7920352608e6fa6639b1f41a632050af115..fe239d39c04d7ffc8bed58bb9110d4aac16da6d7 100644 (file)
@@ -57,11 +57,6 @@ public final class RevisionDateStatementSupport
         return DeclaredStatements.createRevisionDate(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected RevisionDateStatement createEmptyDeclared(final StmtContext<Revision, RevisionDateStatement, ?> ctx) {
-        return DeclaredStatements.createRevisionDate(ctx.getArgument());
-    }
-
     @Override
     protected RevisionDateEffectiveStatement createEffective(final Current<Revision, RevisionDateStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 43e9349dc5c55c93dd611f1edbee697b2ee7bab9..92d38ca583d0862022124b53fd923fa0310437e0 100644 (file)
@@ -60,11 +60,6 @@ public final class RevisionStatementSupport
         return DeclaredStatements.createRevision(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected RevisionStatement createEmptyDeclared(final StmtContext<Revision, RevisionStatement, ?> ctx) {
-        return DeclaredStatements.createRevision(ctx.getArgument());
-    }
-
     @Override
     protected RevisionEffectiveStatement createEffective(final Current<Revision, RevisionStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 171f2c40f223027681c57c0e6d24ed068e7800d5..e98cf06f3dba57ea0de18ac5d9b56d8d24f88c2a 100644 (file)
@@ -97,11 +97,6 @@ public final class RpcStatementSupport extends AbstractSchemaTreeStatementSuppor
         return DeclaredStatements.createRpc(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected RpcStatement createEmptyDeclared(final StmtContext<QName, RpcStatement, ?> ctx) {
-        return DeclaredStatements.createRpc(ctx.getArgument());
-    }
-
     @Override
     protected RpcEffectiveStatement createEffective(final Current<QName, RpcStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 7807ccc23bb61ba00407789cf4985b1aac297956..ed43894378c8b931b56f13329e70baa0cd399d61 100644 (file)
@@ -75,11 +75,6 @@ public final class StatusStatementSupport
         return DeclaredStatements.createStatus(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected StatusStatement createEmptyDeclared(final StmtContext<Status, StatusStatement, ?> ctx) {
-        return DeclaredStatements.createStatus(ctx.getArgument());
-    }
-
     @Override
     protected StatusEffectiveStatement createEffective(final Current<Status, StatusStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index a160ac14e02a0e6b2412d56a67e6f2a7a4885174..6f5c55c2ed644cbbfd9317547a608f7a89a83d57 100644 (file)
@@ -110,11 +110,6 @@ public final class TypedefStatementSupport extends
         return DeclaredStatements.createTypedef(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected TypedefStatement createEmptyDeclared(final StmtContext<QName, TypedefStatement, ?> ctx) {
-        return DeclaredStatements.createTypedef(ctx.getArgument());
-    }
-
     @Override
     protected TypedefEffectiveStatement createEffective(final Current<QName, TypedefStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 84bac5c45e66d36eebb8503d21438b41fdf22a51..9ce1599daa357699d7997a6e3643843c63ef4c9c 100644 (file)
@@ -76,11 +76,6 @@ public final class UniqueStatementSupport
         return DeclaredStatements.createUnique(ctx.getRawArgument(), ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected UniqueStatement createEmptyDeclared(final StmtContext<Set<Descendant>, UniqueStatement, ?> ctx) {
-        return DeclaredStatements.createUnique(ctx.getRawArgument(), ctx.getArgument());
-    }
-
     @Override
     protected UniqueEffectiveStatement createEffective(final Current<Set<Descendant>, UniqueStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 7df82cffec68857c9c2532b5768a6cb3c30f14e6..2359bd24957671b2464cae2b32e6f1dbf5500832 100644 (file)
@@ -46,11 +46,6 @@ public final class UnitsStatementSupport
         return DeclaredStatements.createUnits(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected UnitsStatement createEmptyDeclared(final StmtContext<String, UnitsStatement, ?> ctx) {
-        return DeclaredStatements.createUnits(ctx.getRawArgument());
-    }
-
     @Override
     protected UnitsEffectiveStatement createEffective(final Current<String, UnitsStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index b765780df2f0341812ac306b27debeaef445f63e..ed03d859ace6465d3fa3dd1072d99ad83a2a6110 100644 (file)
@@ -61,11 +61,6 @@ public final class WhenStatementSupport
         return DeclaredStatements.createWhen(ctx.getRawArgument(), ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected WhenStatement createEmptyDeclared(final StmtContext<QualifiedBound, WhenStatement, ?> ctx) {
-        return DeclaredStatements.createWhen(ctx.getRawArgument(), ctx.getArgument());
-    }
-
     @Override
     protected WhenEffectiveStatement createEffective(final Current<QualifiedBound, WhenStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 5cb454f47fc373e3bf28000d1f87f85768ab0e09..1b40a86703ca73a7ae234f8696c753ac6dc1d02e 100644 (file)
@@ -59,11 +59,6 @@ public final class YangVersionStatementSupport
         return DeclaredStatements.createYangVersion(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected YangVersionStatement createEmptyDeclared(final StmtContext<YangVersion, YangVersionStatement, ?> ctx) {
-        return DeclaredStatements.createYangVersion(ctx.getArgument());
-    }
-
     @Override
     protected YangVersionEffectiveStatement createEffective(final Current<YangVersion, YangVersionStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index ad3d73c242d001dec02323adafe98b5b0d1db41d..92045cf46fab7ddb4cb38c9e122881b44197fa0b 100644 (file)
@@ -16,7 +16,6 @@ import org.opendaylight.yangtools.yang.model.api.stmt.YinElementStatement;
 import org.opendaylight.yangtools.yang.model.ri.stmt.DeclaredStatements;
 import org.opendaylight.yangtools.yang.model.ri.stmt.EffectiveStatements;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractBooleanStatementSupport;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
 
 public final class YinElementStatementSupport
@@ -42,9 +41,9 @@ public final class YinElementStatementSupport
     }
 
     @Override
-    protected YinElementStatement createDeclared(final StmtContext<Boolean, YinElementStatement, ?> ctx,
+    protected YinElementStatement createDeclared(final Boolean argument,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return DeclaredStatements.createYinElement(ctx.getArgument(), substatements);
+        return DeclaredStatements.createYinElement(argument, substatements);
     }
 
     @Override
index d6e994694b3d06c2ee7b1d28c684150467dccf8e..d4c2f3f4d5df20634bc1fcc1bb975f6826196ec4 100644 (file)
@@ -251,14 +251,12 @@ public final class ModuleStatementSupport
     @Override
     protected ModuleStatement createDeclared(final StmtContext<UnqualifiedQName, ModuleStatement, ?> ctx,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+        if (substatements.isEmpty()) {
+            throw noNamespace(ctx);
+        }
         return DeclaredStatements.createModule(ctx.getRawArgument(), ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected ModuleStatement createEmptyDeclared(final StmtContext<UnqualifiedQName, ModuleStatement, ?> ctx) {
-        throw noNamespace(ctx);
-    }
-
     @Override
     protected ModuleEffectiveStatement createEffective(final Current<UnqualifiedQName, ModuleStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 7014a246e8cc9c6f35e5c784c07d056ff85cafc0..1bb2e5190e1764b26dd70c8a98519982f4cbfd65 100644 (file)
@@ -62,11 +62,6 @@ public final class MustStatementSupport
         return DeclaredStatements.createMust(ctx.getRawArgument(), ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected MustStatement createEmptyDeclared(final StmtContext<QualifiedBound, MustStatement, ?> ctx) {
-        return DeclaredStatements.createMust(ctx.getRawArgument(), ctx.getArgument());
-    }
-
     @Override
     protected MustEffectiveStatement createEffective(final Current<QualifiedBound, MustStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 7893a30ca253b7ee36e10d38bc0ec84250115ef3..afadd137a08fff41da8f978568910ba87f754b94 100644 (file)
@@ -35,11 +35,6 @@ abstract class AbstractNotificationStatementSupport
         return DeclaredStatements.createNotification(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected final NotificationStatement createEmptyDeclared(final StmtContext<QName, NotificationStatement, ?> ctx) {
-        return DeclaredStatements.createNotification(ctx.getArgument());
-    }
-
     @Override
     protected final NotificationEffectiveStatement createEffective(final Current<QName, NotificationStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index ed276a453ad0201ac39635a519526f4002d326cf..20a1733cb3848ad8aa3091bc584003776e78f55c 100644 (file)
@@ -64,11 +64,6 @@ public final class PathStatementSupport
         return DeclaredStatements.createPath(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected PathStatement createEmptyDeclared(final StmtContext<PathExpression, PathStatement, ?> ctx) {
-        return DeclaredStatements.createPath(ctx.getArgument());
-    }
-
     @Override
     protected PathEffectiveStatement createEffective(final Current<PathExpression, PathStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 26fb656a312bcb9d086d6a1464922a681d33d7d0..a671b87741cc939df2af71e9684095e471a0ed73 100644 (file)
@@ -84,12 +84,6 @@ public final class PatternStatementSupport
         return DeclaredStatements.createPattern(ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected PatternStatement createEmptyDeclared(
-            final StmtContext<PatternExpression, PatternStatement, ?> ctx) {
-        return DeclaredStatements.createPattern(ctx.getArgument());
-    }
-
     @Override
     protected PatternEffectiveStatement createEffective(final Current<PatternExpression, PatternStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 21e4716b3e15e44dd267335c52f16dc31ab63974..a5bf8314e13b4e75e3f4bf5323aaeae7cb63493a 100644 (file)
@@ -88,12 +88,6 @@ public final class RefineStatementSupport
         return DeclaredStatements.createRefine(ctx.getRawArgument(), ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected RefineStatement createEmptyDeclared(final StmtContext<Descendant, RefineStatement, ?> ctx) {
-        // Empty refine is exceedingly unlikely: let's be lazy and reuse the implementation
-        return DeclaredStatements.createRefine(ctx.getRawArgument(), ctx.getArgument());
-    }
-
     @Override
     protected RefineEffectiveStatement createEffective(final Current<Descendant, RefineStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index fd30a920ec165e9f92c35a82d529ddd6f8bbd1fe..200554ea1c1e83aeb1bf69be2ec91459d736b950 100644 (file)
@@ -161,15 +161,12 @@ public final class SubmoduleStatementSupport
     @Override
     protected SubmoduleStatement createDeclared(final StmtContext<UnqualifiedQName, SubmoduleStatement, ?> ctx,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+        if (substatements.isEmpty()) {
+            throw noBelongsTo(ctx);
+        }
         return DeclaredStatements.createSubmodule(ctx.getRawArgument(), ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected SubmoduleStatement createEmptyDeclared(
-            final StmtContext<UnqualifiedQName, SubmoduleStatement, ?> ctx) {
-        throw noBelongsTo(ctx);
-    }
-
     @Override
     protected SubmoduleEffectiveStatement createEffective(final Current<UnqualifiedQName, SubmoduleStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 48f07aa55d0665321f7db63ef0311d873325a43f..6256b76975ad78676136483050e032b60733c348 100644 (file)
@@ -59,15 +59,12 @@ abstract class AbstractIdentityRefSpecificationSupport
     @Override
     protected final IdentityRefSpecification createDeclared(final StmtContext<String, IdentityRefSpecification, ?> ctx,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+        if (substatements.isEmpty()) {
+            throw noBase(ctx);
+        }
         return new IdentityRefSpecificationImpl(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected final IdentityRefSpecification createEmptyDeclared(
-            final StmtContext<String, IdentityRefSpecification, ?> ctx) {
-        throw noBase(ctx);
-    }
-
     @Override
     protected final EffectiveStatement<String, IdentityRefSpecification> createEffective(
             final Current<String, IdentityRefSpecification> stmt,
index b87da19008148cb4d4018bd96211c567c628cdc9..8cd9d4efc0ccb6520619cb4b6f6e57d66b865337 100644 (file)
@@ -31,14 +31,12 @@ abstract class AbstractLeafrefSpecificationSupport extends AbstractStringStateme
     @Override
     protected final LeafrefSpecification createDeclared(final StmtContext<String, LeafrefSpecification, ?> ctx,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+        if (substatements.isEmpty()) {
+            throw noPath(ctx);
+        }
         return new LeafrefSpecificationImpl(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected final LeafrefSpecification createEmptyDeclared(final StmtContext<String, LeafrefSpecification, ?> ctx) {
-        throw noPath(ctx);
-    }
-
     @Override
     protected EffectiveStatement<String, LeafrefSpecification> createEffective(
             final Current<String, LeafrefSpecification> stmt,
index 14d98bb86f3a1c3a74b8e6b3f1e88603e664bfd6..e9fcf74979973ee44fd0dcf7b7d1b71684398658 100644 (file)
@@ -216,16 +216,15 @@ abstract class AbstractTypeStatementSupport
     @Override
     protected final TypeStatement createDeclared(final StmtContext<String, TypeStatement, ?> ctx,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+        if (substatements.isEmpty()) {
+            final TypeStatement builtin = BuiltinTypeStatement.lookup(ctx);
+            if (builtin != null) {
+                return builtin;
+            }
+        }
         return DeclaredStatements.createType(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected final TypeStatement createEmptyDeclared(final StmtContext<String, TypeStatement, ?> ctx) {
-        final TypeStatement builtin;
-        return (builtin = BuiltinTypeStatement.lookup(ctx)) != null ? builtin
-            : DeclaredStatements.createType(ctx.getRawArgument());
-    }
-
     @Override
     protected EffectiveStatement<String, TypeStatement> createEffective(final Current<String, TypeStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index a2f0ec7f1f0fbb211c7819a871daf575fa09a3ec..9a7c32dba1fea21e2dfa4e75a46452c5be126af9 100644 (file)
@@ -44,14 +44,12 @@ final class BitsSpecificationSupport
     @Override
     protected BitsSpecification createDeclared(final StmtContext<String, BitsSpecification, ?> ctx,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+        if (substatements.isEmpty()) {
+            throw noBits(ctx);
+        }
         return new BitsSpecificationImpl(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected BitsSpecification createEmptyDeclared(final StmtContext<String, BitsSpecification, ?> ctx) {
-        throw noBits(ctx);
-    }
-
     @Override
     protected EffectiveStatement<String, BitsSpecification> createEffective(
             final Current<String, BitsSpecification> stmt,
index ade37f09750ae5fba0c3d65d0b05af3e96d35c8f..28aa6b1ff3bfeac0744f0e54def53967ea84f435 100644 (file)
@@ -43,14 +43,12 @@ final class Decimal64SpecificationSupport extends AbstractStringStatementSupport
     @Override
     protected Decimal64Specification createDeclared(final StmtContext<String, Decimal64Specification, ?> ctx,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+        if (substatements.isEmpty()) {
+            throw noFracDigits(ctx);
+        }
         return new Decimal64SpecificationImpl(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected Decimal64Specification createEmptyDeclared(final StmtContext<String, Decimal64Specification, ?> ctx) {
-        throw noFracDigits(ctx);
-    }
-
     @Override
     protected EffectiveStatement<String, Decimal64Specification> createEffective(
             final Current<String, Decimal64Specification> stmt,
index 7cb8792ec00556354557b9518f3dea359b019238..55496111a19817358c5a3df497a7bad18b791604 100644 (file)
@@ -42,14 +42,12 @@ final class EnumSpecificationSupport
     @Override
     protected EnumSpecification createDeclared(final StmtContext<String, EnumSpecification, ?> ctx,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+        if (substatements.isEmpty()) {
+            throw noEnum(ctx);
+        }
         return new EnumSpecificationImpl(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected EnumSpecification createEmptyDeclared(final StmtContext<String, EnumSpecification, ?> ctx) {
-        throw noEnum(ctx);
-    }
-
     @Override
     protected EffectiveStatement<String, EnumSpecification> createEffective(
             final Current<String, EnumSpecification> stmt,
index 16dfa87c28c25717daff9e0eed469ac220b82b3d..785ae274a43871f0f6310e051fea4dea216fbe23 100644 (file)
@@ -42,13 +42,8 @@ final class InstanceIdentifierSpecificationSupport
     protected InstanceIdentifierSpecification createDeclared(
             final StmtContext<String, InstanceIdentifierSpecification, ?> ctx,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return new RegularInstanceIdentifierSpecification(ctx.getRawArgument(), substatements);
-    }
-
-    @Override
-    protected InstanceIdentifierSpecification createEmptyDeclared(
-            final StmtContext<String, InstanceIdentifierSpecification, ?> ctx) {
-        return new EmptyIdentifierSpecification(ctx.getRawArgument());
+        return substatements.isEmpty() ? new EmptyIdentifierSpecification(ctx.getRawArgument())
+            : new RegularInstanceIdentifierSpecification(ctx.getRawArgument(), substatements);
     }
 
     @Override
index 44d6fcdf6ceb4be72d3e9a14d42d015e1a112db2..99814c0da0487f6916afd385db9076a9b08dd628 100644 (file)
@@ -42,14 +42,12 @@ final class UnionSpecificationSupport
     @Override
     protected UnionSpecification createDeclared(final StmtContext<String, UnionSpecification, ?> ctx,
             final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+        if (substatements.isEmpty()) {
+            throw noType(ctx);
+        }
         return new UnionSpecificationImpl(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected UnionSpecification createEmptyDeclared(final StmtContext<String, UnionSpecification, ?> ctx) {
-        throw noType(ctx);
-    }
-
     @Override
     protected EffectiveStatement<String, UnionSpecification> createEffective(
             final Current<String, UnionSpecification> stmt,
index f1cdf9079fc1922f243234f1a07ee8ad22e3a739..4efba3e7f256745f93c1e5cd36d7cb7ea13a9f46 100644 (file)
@@ -142,11 +142,6 @@ public final class UsesStatementSupport
         return DeclaredStatements.createUses(ctx.getRawArgument(), ctx.getArgument(), substatements);
     }
 
-    @Override
-    protected UsesStatement createEmptyDeclared(final StmtContext<QName, UsesStatement, ?> ctx) {
-        return DeclaredStatements.createUses(ctx.getRawArgument(), ctx.getArgument());
-    }
-
     @Override
     protected UsesEffectiveStatement createEffective(final Current<QName, UsesStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index 89a58743b96754e6e0a23bcf36710cd56a022386..906d6bd64106f813cc97d2b718b6dd3c68255744 100644 (file)
@@ -19,7 +19,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
 
 public final class ThirdPartyExtensionSupport
         extends AbstractStringStatementSupport<ThirdPartyExtensionStatement, ThirdPartyExtensionEffectiveStatement> {
-
     private static final ThirdPartyExtensionSupport INSTANCE = new ThirdPartyExtensionSupport();
 
     private ThirdPartyExtensionSupport() {
@@ -49,12 +48,6 @@ public final class ThirdPartyExtensionSupport
         return new ThirdPartyExtensionStatementImpl(ctx.getRawArgument(), substatements);
     }
 
-    @Override
-    protected ThirdPartyExtensionStatement createEmptyDeclared(
-            final StmtContext<String, ThirdPartyExtensionStatement, ?> ctx) {
-        return createDeclared(ctx, ImmutableList.of());
-    }
-
     @Override
     protected ThirdPartyExtensionEffectiveStatement createEffective(
             final Current<String, ThirdPartyExtensionStatement> stmt,
index 5b225509cd63d2ff95c720182858497f861153df..248d7233f4a3cacef0d5fb31f6f62a31124c931a 100644 (file)
@@ -66,10 +66,18 @@ public abstract class AbstractBooleanStatementSupport<D extends DeclaredStatemen
     }
 
     @Override
-    protected final D createEmptyDeclared(final StmtContext<Boolean, D, ?> ctx) {
-        return ctx.getArgument() ? emptyDeclaredTrue : emptyDeclaredFalse;
+    protected final D createDeclared(final StmtContext<Boolean, D, ?> ctx,
+            final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+        final Boolean argument = ctx.getArgument();
+        if (substatements.isEmpty()) {
+            return argument ? emptyDeclaredTrue : emptyDeclaredFalse;
+        }
+        return createDeclared(argument, substatements);
     }
 
+    protected abstract @NonNull D createDeclared(@NonNull Boolean argument,
+        @NonNull ImmutableList<? extends DeclaredStatement<?>> substatements);
+
     @Override
     protected final E createEffective(final Current<Boolean, D> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
index ef68364f6f7de3cf81541bc56a825dd37e679d38..cf38300225f1028401bdedd2f43862b57dc2ab59 100644 (file)
@@ -51,10 +51,16 @@ public abstract class AbstractInternedStatementSupport<A, D extends DeclaredStat
     }
 
     @Override
-    protected final D createEmptyDeclared(final StmtContext<A, D, ?> ctx) {
-        return declaredCache.getUnchecked(ctx.getArgument());
+    protected final D createDeclared(final StmtContext<A, D, ?> ctx,
+            final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+        final A argument = ctx.getArgument();
+        return substatements.isEmpty() ? declaredCache.getUnchecked(ctx.getArgument())
+            : createDeclared(argument, substatements);
     }
 
+    protected abstract @NonNull D createDeclared(@NonNull A argument,
+            @NonNull ImmutableList<? extends DeclaredStatement<?>> substatements);
+
     protected abstract @NonNull D createEmptyDeclared(@NonNull A argument);
 
     @Override
@@ -68,13 +74,4 @@ public abstract class AbstractInternedStatementSupport<A, D extends DeclaredStat
         @NonNull ImmutableList<? extends EffectiveStatement<?, ?>> substatements);
 
     protected abstract @NonNull E createEmptyEffective(@NonNull D declared);
-
-    @Override
-    protected final D createDeclared(final StmtContext<A, D, ?> ctx,
-            final ImmutableList<? extends DeclaredStatement<?>> substatements) {
-        return createDeclared(ctx.getArgument(), substatements);
-    }
-
-    protected abstract @NonNull D createDeclared(@NonNull A argument,
-            ImmutableList<? extends DeclaredStatement<?>> substatements);
 }
index c3ed5edfcbf82224b4667ca417a017d0ec9ef9d2..2ab22dde41b06cfba49714e2b5572ef12b554753 100644 (file)
@@ -40,17 +40,14 @@ public abstract class AbstractStatementSupport<A, D extends DeclaredStatement<A>
 
     @Override
     public final D createDeclared(final StmtContext<A, D, ?> ctx) {
-        final ImmutableList<? extends DeclaredStatement<?>> substatements = ctx.declaredSubstatements().stream()
-                .map(StmtContext::declared)
-                .collect(ImmutableList.toImmutableList());
-        return substatements.isEmpty() ? createEmptyDeclared(ctx) : createDeclared(ctx, substatements);
+        return createDeclared(ctx, ctx.declaredSubstatements().stream()
+            .map(StmtContext::declared)
+            .collect(ImmutableList.toImmutableList()));
     }
 
     protected abstract @NonNull D createDeclared(@NonNull StmtContext<A, D, ?> ctx,
             @NonNull ImmutableList<? extends DeclaredStatement<?>> substatements);
 
-    protected abstract @NonNull D createEmptyDeclared(@NonNull StmtContext<A, D, ?> ctx);
-
     @Override
     public final E createEffective(final Current<A, D> stmt,
             final Stream<? extends StmtContext<?, ?, ?>> declaredSubstatements,