2 * Copyright (c) 2018 Pantheon Technologies, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.binding;
10 import java.io.IOException;
11 import java.io.ObjectInput;
12 import java.io.ObjectOutput;
13 import java.io.ObjectStreamException;
14 import java.io.Serial;
15 import org.eclipse.jdt.annotation.Nullable;
17 final class KeyedInstanceIdentifierV2<T extends Identifiable<K> & DataObject, K extends Identifier<T>>
18 extends InstanceIdentifierV3<T> {
20 private static final long serialVersionUID = 2L;
22 private @Nullable K key;
24 @SuppressWarnings("redundantModifier")
25 public KeyedInstanceIdentifierV2() {
29 KeyedInstanceIdentifierV2(final KeyedInstanceIdentifier<T, K> source) {
31 key = source.getKey();
35 public void writeExternal(final ObjectOutput out) throws IOException {
36 super.writeExternal(out);
41 public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
42 super.readExternal(in);
43 key = (K) in.readObject();
48 Object readResolve() throws ObjectStreamException {
49 return new KeyedInstanceIdentifier<>(getTargetType(), getPathArguments(), isWildcarded(), getHash(), key);