java - Msgpack Generic serialization/desrialization -


i using msgpack integrated axon framework. on axon event handler object's on runtime can of type.as object type unknown, want use generic serialization/deserialiation. serialization done issue arises when deserialize byte stream. ex:

public <s, t> t deserialize(serializedobject<s> serializedobject) {     byte[] serializedbytes= (byte[]) serializedobject.getdata();     object bytes = null;     try {         bytes=objectmapper.readvalue(serializedbytes,object.class);         system.out.println("after deserialization : "+bytes);     } catch (ioexception e) {         // todo auto-generated catch block         e.printstacktrace();     }     return (t) bytes; } 

where serializedobject has custom method getdata() contains serialized bytes. here read value & give representation object.class linkedhashmap in return value target. there standard way perform generic serialization / deserialization object type using msgpack.

without type information won't possible deserialize object @ runtime using msgpack see here


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -