serialization - Generate Avro Schema from certain Java Object -


apache avro provides compact, fast, binary data format, rich data structure serialization. however, requires user define schema (in json) object need serialized.

in case, can not possible (e.g: class of java object has members types external java classes in external libraries). hence, wonder there tool can information object's .class file , generate avro schema object (like gson use object's .class information convert object json string).

take @ the java reflection api.

getting schema looks like:

schema schema = reflectdata.get().getschema(t); 

see example doug on question working example.

credits of answer belong sean busby.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -