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 org.eclipse.jdt.annotation.Nullable;
16 final class KeyedInstanceIdentifierV2<T extends Identifiable<K> & DataObject, K extends Identifier<T>>
17 extends InstanceIdentifierV3<T> {
18 private static final long serialVersionUID = 2L;
20 private @Nullable K key;
22 @SuppressWarnings("redundantModifier")
23 public KeyedInstanceIdentifierV2() {
27 KeyedInstanceIdentifierV2(final KeyedInstanceIdentifier<T, K> source) {
29 key = source.getKey();
33 public void writeExternal(final ObjectOutput out) throws IOException {
34 super.writeExternal(out);
39 public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
40 super.readExternal(in);
41 key = (K) in.readObject();
44 private Object readResolve() throws ObjectStreamException {
45 return new KeyedInstanceIdentifier<>(getTargetType(), getPathArguments(), isWildcarded(), getHash(), key);