- SerializationUtils.serializeNormalizedNode(normalizedNode, out);
- }
-
- @Override
- public Object toSerializable() {
- if(getVersion() >= DataStoreVersions.LITHIUM_VERSION) {
- return this;
- } else {
- return toSerializableReadDataReply(normalizedNode);
- }
- }
-
- private static ShardTransactionMessages.ReadDataReply toSerializableReadDataReply(
- NormalizedNode<?, ?> normalizedNode) {
- if(normalizedNode != null) {
- return ShardTransactionMessages.ReadDataReply.newBuilder()
- .setNormalizedNode(new NormalizedNodeToNodeCodec(null)
- .encode(normalizedNode).getNormalizedNode()).build();
- } else {
- return ShardTransactionMessages.ReadDataReply.newBuilder().build();
-
- }
- }
-
- public static ReadDataReply fromSerializable(Object serializable) {
- if(serializable instanceof ReadDataReply) {
- return (ReadDataReply) serializable;
- } else {
- ShardTransactionMessages.ReadDataReply o =
- (ShardTransactionMessages.ReadDataReply) serializable;
- return new ReadDataReply(new NormalizedNodeToNodeCodec(null).decode(o.getNormalizedNode()),
- DataStoreVersions.HELIUM_2_VERSION);
- }