Add default effectiveSubstatements() implementation 70/87270/1
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 26 Jan 2020 17:32:13 +0000 (18:32 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 29 Jan 2020 16:14:23 +0000 (17:14 +0100)
AbstractEffectiveStatement subclasses can benefit from a common
implementation, reducing code duplication. This organization
mirrors the layout of AbstractDeclaredStatement.

JIRA: YANGTOOLS-1065
Change-Id: I869958ad8a154df0d6f66c91108631ef54aad2b8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit faae563ab28dbfe2fd9763448359cf113d400368)

14 files changed:
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/AbstractEffectiveStatement.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/belongs_to/EmptyBelongsToEffectiveStatement.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/contact/EmptyContactEffectiveStatement.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/default_/EmptyDefaultEffectiveStatement.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/description/EmptyDescriptionEffectiveStatement.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/error_app_tag/EmptyErrorAppTagEffectiveStatement.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/error_message/EmptyErrorMessageEffectiveStatement.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/key/EmptyForeignKeyEffectiveStatement.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/key/EmptyLocalKeyEffectiveStatement.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/ordered_by/EmptyOrderedByEffectiveStatement.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/prefix/EmptyPrefixEffectiveStatement.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/presence/EmptyPresenceEffectiveStatement.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/reference/EmptyReferenceEffectiveStatement.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/units/EmptyUnitsEffectiveStatement.java

index 3ba956cd9222e1df850249b8cd9dc162c201180e..95d3931b8f465fa5b02dab765eb79c2e9fd7067a 100644 (file)
@@ -10,7 +10,9 @@ package org.opendaylight.yangtools.yang.parser.rfc7950.stmt;
 import static java.util.Objects.requireNonNull;
 
 import com.google.common.annotations.Beta;
+import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
+import java.util.Collection;
 import java.util.Map;
 import java.util.Optional;
 import org.eclipse.jdt.annotation.NonNull;
@@ -45,6 +47,11 @@ public abstract class AbstractEffectiveStatement<A, D extends DeclaredStatement<
         return ret.isPresent() ? ret.get() : ImmutableMap.of();
     }
 
+    @Override
+    public Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
+        return ImmutableList.of();
+    }
+
     /**
      * Return the statement-specific contents of specified namespace, if available.
      *
index 33697198c4e175eb3d51bd6caddb29e7578dead2..7274d86f6ea2b2bfbdddbf333b89a1468117984c 100644 (file)
@@ -7,17 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.belongs_to;
 
-import com.google.common.collect.ImmutableList;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToStatement;
 
 final class EmptyBelongsToEffectiveStatement extends AbstractBelongsToEffectiveStatement {
     EmptyBelongsToEffectiveStatement(final BelongsToStatement declared) {
         super(declared);
     }
-
-    @Override
-    public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
-        return ImmutableList.of();
-    }
 }
index 43bef76d34a64642b01a4a5ca1dfd4ed6182c761..5f2cc8a04513912ead9741c105064b01258ed885 100644 (file)
@@ -7,17 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.contact;
 
-import com.google.common.collect.ImmutableList;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ContactStatement;
 
 final class EmptyContactEffectiveStatement extends AbstractContactEffectiveStatement {
     EmptyContactEffectiveStatement(final ContactStatement declared) {
         super(declared);
     }
-
-    @Override
-    public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
-        return ImmutableList.of();
-    }
 }
index bb6e55e776dcccc4883c543d786939ed6e8bbfef..fbf15a8d187bfa867376254fdc5e1138c60f8d88 100644 (file)
@@ -7,17 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.default_;
 
-import com.google.common.collect.ImmutableList;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.DefaultStatement;
 
 final class EmptyDefaultEffectiveStatement extends AbstractDefaultEffectiveStatement {
     EmptyDefaultEffectiveStatement(final DefaultStatement declared) {
         super(declared);
     }
-
-    @Override
-    public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
-        return ImmutableList.of();
-    }
 }
index eec36d06b9220e12e561697f1d90397f45ec3a09..84e65fe101ff66ac6f5fd487e20ba82fb9d17a96 100644 (file)
@@ -7,17 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.description;
 
-import com.google.common.collect.ImmutableList;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
 
 final class EmptyDescriptionEffectiveStatement extends AbstractDescriptionEffectiveStatement {
     EmptyDescriptionEffectiveStatement(final DescriptionStatement declared) {
         super(declared);
     }
-
-    @Override
-    public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
-        return ImmutableList.of();
-    }
 }
index 10ee9759c7c2b35c5de3608f4d693986a6547403..75bee977016c621c1ffb44d30f13afc73f97130c 100644 (file)
@@ -7,17 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.error_app_tag;
 
-import com.google.common.collect.ImmutableList;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
 
 final class EmptyErrorAppTagEffectiveStatement extends AbstractErrorAppTagEffectiveStatement {
     EmptyErrorAppTagEffectiveStatement(final ErrorAppTagStatement declared) {
         super(declared);
     }
-
-    @Override
-    public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
-        return ImmutableList.of();
-    }
 }
index 15c88e487947b57a148e7012f5c787d34e0c9e53..09c2290fd4422203ef782a1cfe0d5deb0d6e3a57 100644 (file)
@@ -7,17 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.error_message;
 
-import com.google.common.collect.ImmutableList;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
 
 final class EmptyErrorMessageEffectiveStatement extends AbstractErrorMessageEffectiveStatement {
     EmptyErrorMessageEffectiveStatement(final ErrorMessageStatement declared) {
         super(declared);
     }
-
-    @Override
-    public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
-        return ImmutableList.of();
-    }
 }
index b9547c5c78859dff36b0fddd549f3d107fccc9cd..ec3b19901543d4092e2648d18f5659b457f8bcf1 100644 (file)
@@ -7,9 +7,7 @@
  */
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.key;
 
-import com.google.common.collect.ImmutableList;
 import java.util.Collection;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.KeyStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
 
@@ -17,9 +15,4 @@ final class EmptyForeignKeyEffectiveStatement extends AbstractKeyEffectiveStatem
     EmptyForeignKeyEffectiveStatement(final KeyStatement declared, final Collection<SchemaNodeIdentifier> argument) {
         super(declared, argument);
     }
-
-    @Override
-    public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
-        return ImmutableList.of();
-    }
 }
index 1eb2666a05e5d3d5376a0c426bb871d12309c053..3919ece127a2e46822aa28b703b6ac9d0b3db286 100644 (file)
@@ -7,17 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.key;
 
-import com.google.common.collect.ImmutableList;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.KeyStatement;
 
 final class EmptyLocalKeyEffectiveStatement extends AbstractKeyEffectiveStatement.Local {
     EmptyLocalKeyEffectiveStatement(final KeyStatement declared) {
         super(declared);
     }
-
-    @Override
-    public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
-        return ImmutableList.of();
-    }
 }
index 8eeb1d6a90c5a994f76298a11bf9d33224b231e5..2f70796d73e24402d11c3103012febbb0de5e8ec 100644 (file)
@@ -7,17 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.ordered_by;
 
-import com.google.common.collect.ImmutableList;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByStatement;
 
 final class EmptyOrderedByEffectiveStatement extends AbstractOrderedByEffectiveStatement {
     EmptyOrderedByEffectiveStatement(final OrderedByStatement declared) {
         super(declared);
     }
-
-    @Override
-    public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
-        return ImmutableList.of();
-    }
 }
index 62aa3f7f6c4d2d1182b59882aa16613170270df7..2ea78b3f1c51235e1ac7b37a11cea7ee4d976fe2 100644 (file)
@@ -7,17 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.prefix;
 
-import com.google.common.collect.ImmutableList;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.PrefixStatement;
 
 final class EmptyPrefixEffectiveStatement extends AbstractPrefixEffectiveStatement {
     EmptyPrefixEffectiveStatement(final PrefixStatement declared) {
         super(declared);
     }
-
-    @Override
-    public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
-        return ImmutableList.of();
-    }
 }
index 536ebc42803c037856856fb95ced4399cb496eb9..eaeb1e719668ecaf0fc0400fb78e22e1c8c3e8a5 100644 (file)
@@ -7,17 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.presence;
 
-import com.google.common.collect.ImmutableList;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.PresenceStatement;
 
 final class EmptyPresenceEffectiveStatement extends AbstractPresenceEffectiveStatement {
     EmptyPresenceEffectiveStatement(final PresenceStatement declared) {
         super(declared);
     }
-
-    @Override
-    public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
-        return ImmutableList.of();
-    }
 }
index fa2bc6e9e343a979196931a591a299dd458b3478..95e4385fef55c53091721d47a0e23d837df217be 100644 (file)
@@ -7,17 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.reference;
 
-import com.google.common.collect.ImmutableList;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
 
 final class EmptyReferenceEffectiveStatement extends AbstractReferenceEffectiveStatement {
     EmptyReferenceEffectiveStatement(final ReferenceStatement declared) {
         super(declared);
     }
-
-    @Override
-    public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
-        return ImmutableList.of();
-    }
 }
index a52bc3f53ddaf7f20d2846678dff95cce17255ca..d880f4e1c707db20033a4b7d43e91bb9e72d1cf6 100644 (file)
@@ -7,17 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.units;
 
-import com.google.common.collect.ImmutableList;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.UnitsStatement;
 
 final class EmptyUnitsEffectiveStatement extends AbstractUnitsEffectiveStatement {
     EmptyUnitsEffectiveStatement(final UnitsStatement declared) {
         super(declared);
     }
-
-    @Override
-    public ImmutableList<? extends EffectiveStatement<?, ?>> effectiveSubstatements() {
-        return ImmutableList.of();
-    }
 }