Reformulate StatementContextFactory.createEffective()
[yangtools.git] / yang / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / thirdparty / plugin / ThirdPartyExtensionEffectiveStatementImpl.java
index 33551cd78f9a9f5e9e70b696254f97678645898b..67bdc4c2ca9391bfc2c0d9658f4d13ebd9fce512 100644 (file)
@@ -5,27 +5,28 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.yangtools.yang.thirdparty.plugin;
 
-import java.util.Objects;
-import javax.annotation.Nonnull;
+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.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.UnknownEffectiveStatementBase;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
 
 final class ThirdPartyExtensionEffectiveStatementImpl
         extends UnknownEffectiveStatementBase<String, ThirdPartyExtensionStatement>
         implements ThirdPartyExtensionEffectiveStatement {
 
-    private final SchemaPath path;
+    private final @NonNull SchemaPath path;
     private final String valueFromNamespace;
 
-    ThirdPartyExtensionEffectiveStatementImpl(final StmtContext<String, ThirdPartyExtensionStatement, ?> ctx) {
-        super(ctx);
-        path = ctx.getParentContext().getSchemaPath().get().createChild(getNodeType());
-        valueFromNamespace = ctx.getFromNamespace(ThirdPartyNamespace.class, ctx);
+    ThirdPartyExtensionEffectiveStatementImpl(final Current<String, ThirdPartyExtensionStatement> stmt,
+            final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
+        super(stmt, substatements);
+        path = stmt.getParent().getSchemaPath().createChild(getNodeType());
+        valueFromNamespace = stmt.getFromNamespace(ThirdPartyNamespace.class, stmt.caerbannog());
     }
 
     @Override
@@ -33,44 +34,14 @@ final class ThirdPartyExtensionEffectiveStatementImpl
         return valueFromNamespace;
     }
 
-    @Nonnull
     @Override
     public QName getQName() {
         return getNodeType();
     }
 
-    @Nonnull
     @Override
+    @Deprecated
     public SchemaPath getPath() {
         return path;
     }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(path, getNodeType(), getNodeParameter());
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        final ThirdPartyExtensionEffectiveStatementImpl other = (ThirdPartyExtensionEffectiveStatementImpl) 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;
-    }
 }