2 * Copyright (c) 2014 Cisco Systems, Inc. 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.controller.cluster.datastore.messages;
10 import java.io.IOException;
11 import java.io.ObjectInput;
12 import java.io.ObjectOutput;
13 import org.opendaylight.controller.cluster.datastore.node.utils.stream.SerializationUtils;
14 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
16 public class ReadDataReply extends VersionedExternalizableMessage {
17 private static final long serialVersionUID = 1L;
19 private NormalizedNode normalizedNode;
21 public ReadDataReply() {
24 public ReadDataReply(final NormalizedNode normalizedNode, final short version) {
26 this.normalizedNode = normalizedNode;
29 public NormalizedNode getNormalizedNode() {
30 return normalizedNode;
34 public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
35 super.readExternal(in);
36 normalizedNode = SerializationUtils.readNormalizedNode(in).orElse(null);
40 public void writeExternal(final ObjectOutput out) throws IOException {
41 super.writeExternal(out);
42 SerializationUtils.writeNormalizedNode(out, getStreamVersion(), normalizedNode);
45 public static ReadDataReply fromSerializable(final Object serializable) {
46 return (ReadDataReply) serializable;
49 public static boolean isSerializedType(final Object message) {
50 return message instanceof ReadDataReply;