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.common;
10 import static com.google.common.base.Verify.verifyNotNull;
11 import static java.util.Objects.requireNonNull;
13 import java.io.Externalizable;
14 import java.io.IOException;
15 import java.io.ObjectInput;
16 import java.io.ObjectOutput;
19 * Externalizable proxy for {@link QNameModule}.
21 final class NSv1 implements Externalizable {
22 private static final long serialVersionUID = 1L;
24 private QNameModule namespace;
26 @SuppressWarnings("checkstyle:redundantModifier")
31 NSv1(final QNameModule qname) {
32 this.namespace = requireNonNull(qname);
36 public void writeExternal(final ObjectOutput out) throws IOException {
37 namespace.writeTo(out);
41 public void readExternal(final ObjectInput in) throws IOException {
42 namespace = QNameModule.readFrom(in);
45 Object readResolve() {
46 return verifyNotNull(namespace);