Monday, 19 August 2019

create java class from json --- code generator


http://www.jsonschema2pojo.org/

you can paste your json directly and it will generate java beans, but nice to have json Schema which can generate javadoc for you as well (comments)


if you do things like kafka or mongo  with lombok, i recommend you make it very simple: take off all tick boxes, just keep "use double for numbers".  " Annotation style:" to none.

and then download it as a zip.

Then:
1. just open every file to add annotation @Data to all classes. (which will create setter getter and constructers, tostring for you)
2, just add monogo annotation @Document(collection = "yourcollectionname"for the root class.




No comments:

Post a comment