Fix somar complaints in equals methods
[yangtools.git] / yang / rfc6643-parser-support / src / main / java / org / opendaylight / yangtools / rfc6643 / parser / AliasEffectiveStatementImpl.java
index 2a81cbaa4502be1fd46e1bcfea47133f3f627897..4328a49216ee53c21d2fa05ba67a05ff389f1ec3 100644 (file)
@@ -22,15 +22,11 @@ final class AliasEffectiveStatementImpl extends UnknownEffectiveStatementBase<St
         implements AliasEffectiveStatement, AliasSchemaNode {
     private final SchemaPath path;
 
-    AliasEffectiveStatementImpl(final StmtContext<String, AliasStatement, ?> ctx,
-            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        super(ctx, substatements);
-        path = ctx.getParentContext().getSchemaPath().get().createChild(getNodeType());
-    }
-
-    @Override
-    public String getArgument() {
-        return argument();
+    AliasEffectiveStatementImpl(final AliasStatement declared,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements,
+            final StmtContext<String, AliasStatement, ?> ctx) {
+        super(ctx.coerceStatementArgument(), declared, substatements, ctx);
+        path = ctx.coerceParentContext().getSchemaPath().get().createChild(getNodeType());
     }
 
     @Override
@@ -39,10 +35,16 @@ final class AliasEffectiveStatementImpl extends UnknownEffectiveStatementBase<St
     }
 
     @Override
+    @Deprecated
     public SchemaPath getPath() {
         return path;
     }
 
+    @Override
+    public AliasEffectiveStatement asEffectiveStatement() {
+        return this;
+    }
+
     @Override
     public int hashCode() {
         return Objects.hash(path, getNodeType(), getNodeParameter());
@@ -53,22 +55,11 @@ final class AliasEffectiveStatementImpl extends UnknownEffectiveStatementBase<St
         if (this == obj) {
             return true;
         }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
+        if (!(obj instanceof AliasEffectiveStatementImpl)) {
             return false;
         }
         final AliasEffectiveStatementImpl other = (AliasEffectiveStatementImpl) obj;
-        if (!Objects.equals(path, other.path)) {
-            return false;
-        }
-        if (!Objects.equals(getNodeType(), other.getNodeType())) {
-            return false;
-        }
-        if (!Objects.equals(getNodeParameter(), other.getNodeParameter())) {
-            return false;
-        }
-        return true;
+        return Objects.equals(getNodeType(), other.getNodeType())
+            && Objects.equals(getNodeParameter(), other.getNodeParameter()) && Objects.equals(path, other.path);
     }
 }