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;
16 import org.opendaylight.yangtools.yang.common.QName;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
20 * Externalizable proxy for {@link NodeIdentifier}.
22 final class NIv1 implements Externalizable {
23 private static final long serialVersionUID = 1L;
25 private NodeIdentifier nid;
27 @SuppressWarnings("checkstyle:redundantModifier")
32 NIv1(final NodeIdentifier nid) {
33 this.nid = requireNonNull(nid);
37 public void writeExternal(final ObjectOutput out) throws IOException {
38 nid.getNodeType().writeTo(out);
42 public void readExternal(final ObjectInput in) throws IOException {
43 nid = new NodeIdentifier(QName.readFrom(in));
46 private Object readResolve() {