2 * Copyright (c) 2023 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.mdsal.dom.api;
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;
17 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
18 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
21 * A serialization proxy for {@link DOMDataTreeIdentifier}.
23 final class DTIv1 implements Externalizable {
25 private static final long serialVersionUID = 1L;
27 private DOMDataTreeIdentifier id;
29 @SuppressWarnings("redundantModifier")
34 DTIv1(final DOMDataTreeIdentifier id) {
35 this.id = requireNonNull(id);
39 public void writeExternal(final ObjectOutput out) throws IOException {
40 id.datastore().writeTo(out);
41 out.writeObject(id.path());
45 public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
46 id = DOMDataTreeIdentifier.of(LogicalDatastoreType.readFrom(in), (YangInstanceIdentifier) in.readObject());
50 Object readResolve() {
51 return verifyNotNull(id);