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

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -