Refactor PathArgument to DataObjectStep
[mdsal.git] / binding / yang-binding / src / main / java / org / opendaylight / yangtools / yang / binding / KeyedInstanceIdentifierV2.java
index df19d31ff6ba6c053c28da5a1164525f0d93c094..a9f718298d5440d564a5759fd231f53ec3c722eb 100644 (file)
@@ -12,25 +12,19 @@ import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.io.ObjectStreamException;
 import java.io.Serial;
-import org.eclipse.jdt.annotation.Nullable;
 
 final class KeyedInstanceIdentifierV2<T extends KeyAware<K> & DataObject, K extends Key<T>>
         extends InstanceIdentifierV3<T> {
-    @Serial
+    @java.io.Serial
     private static final long serialVersionUID = 2L;
 
-    private @Nullable K key;
+    private K key;
 
     @SuppressWarnings("redundantModifier")
     public KeyedInstanceIdentifierV2() {
         // For Externalizable
     }
 
-    KeyedInstanceIdentifierV2(final KeyedInstanceIdentifier<T, K> source) {
-        super(source);
-        key = source.getKey();
-    }
-
     @Override
     public void writeExternal(final ObjectOutput out) throws IOException {
         super.writeExternal(out);
@@ -46,6 +40,7 @@ final class KeyedInstanceIdentifierV2<T extends KeyAware<K> & DataObject, K exte
     @Serial
     @Override
     Object readResolve() throws ObjectStreamException {
-        return new KeyedInstanceIdentifier<>(getTargetType(), getPathArguments(), isWildcarded(), getHash(), key);
+        return new KeyedInstanceIdentifier<>(new KeyStep<>(getTargetType(), key), getPathArguments(),
+            isWildcarded(), getHash());
     }
 }