- public static ReadDataReply fromSerializable(SchemaContext schemaContext,YangInstanceIdentifier id,Object serializable){
- ShardTransactionMessages.ReadDataReply o = (ShardTransactionMessages.ReadDataReply) serializable;
- return new ReadDataReply(schemaContext,new NormalizedNodeToNodeCodec(schemaContext).decode(id, o.getNormalizedNode()));
- }
+ }
+ }
+
+ 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);
+ }
+ }
+
+ public static ByteString fromSerializableAsByteString(Object serializable) {
+ if(serializable instanceof ReadDataReply) {
+ ReadDataReply r = (ReadDataReply)serializable;
+ return toSerializableReadDataReply(r.getNormalizedNode()).toByteString();
+ } else {
+ ShardTransactionMessages.ReadDataReply o =
+ (ShardTransactionMessages.ReadDataReply) serializable;
+ return o.getNormalizedNode().toByteString();
+ }
+ }
+
+ public static boolean isSerializedType(Object message) {
+ return SERIALIZABLE_CLASS.isAssignableFrom(message.getClass()) ||
+ message instanceof ShardTransactionMessages.ReadDataReply;
+ }