Do not pretty-print body class
[yangtools.git] / data / yang-data-api / src / main / java / org / opendaylight / yangtools / yang / data / api / DSIv1.java
1 /*
2  * Copyright (c) 2019 PANTHEON.tech s.r.o. and others. All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.data.api;
9
10 import static java.util.Objects.requireNonNull;
11
12 import java.io.Externalizable;
13 import java.io.IOException;
14 import java.io.ObjectInput;
15 import java.io.ObjectOutput;
16 import org.eclipse.jdt.annotation.NonNull;
17 import org.opendaylight.yangtools.yang.common.QName;
18
19 final class DSIv1 implements Externalizable {
20     private static final long serialVersionUID = 1L;
21
22     private QName qname;
23
24     @SuppressWarnings("checkstyle:redundantModifier")
25     public DSIv1() {
26         // For Externalizable
27     }
28
29     DSIv1(final @NonNull QName qname) {
30         this.qname = requireNonNull(qname);
31     }
32
33     @Override
34     public void writeExternal(final ObjectOutput out) throws IOException {
35         qname.writeTo(out);
36     }
37
38     @Override
39     public void readExternal(final ObjectInput in) throws IOException {
40         qname = QName.readFrom(in);
41     }
42
43     private Object readResolve() {
44         return DatastoreIdentifier.create(qname);
45     }
46 }