2 * Copyright (c) 2019 PANTHEON.tech, 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.data.api;
10 import static java.util.Objects.requireNonNull;
12 import java.io.Externalizable;
13 import java.io.IOException;
14 import java.io.ObjectInput;
15 import java.io.ObjectOutput;
17 import org.opendaylight.yangtools.yang.common.QName;
18 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
21 * Externalizable proxy for {@link NodeIdentifierWithPredicates}.
23 final class NIPv1 implements Externalizable {
24 private static final long serialVersionUID = 1L;
26 private NodeIdentifierWithPredicates nip;
28 @SuppressWarnings("checkstyle:redundantModifier")
33 NIPv1(final NodeIdentifierWithPredicates nid) {
34 this.nip = requireNonNull(nid);
38 public void writeExternal(final ObjectOutput out) throws IOException {
39 nip.getNodeType().writeTo(out);
40 out.writeObject(nip.getKeyValues());
44 public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
45 final QName qname = QName.readFrom(in);
46 nip = new NodeIdentifierWithPredicates((Map<QName, Object>) in.readObject(), qname);
49 private Object readResolve() {