Gerar esquema JSON a partir da classe java
Eu tenho uma aula POJO
public class Stock{
int id;
String name;
Date date;
}
Existe alguma anotação ou estrutura / API de desenvolvimento que possa converter o esquema POJO para JSON como abaixo
{"id":
{
"type" : "int"
},
"name":{
"type" : "string"
}
"date":{
"type" : "Date"
}
}
e também posso expandir o esquema para adicionar informações como "Obrigatório": "Sim", descrição para cada campo, etc., especificando algumas anotações ou configurações no POJO e pode gerar o esquema JSON como abaixo.
{"id":
{
"type" : "int",
"Required" : "Yes",
"format" : "id must not be greater than 99999",
"description" : "id of the stock"
},
"name":{
"type" : "string",
"Required" : "Yes",
"format" : "name must not be empty and must be 15-30 characters length",
"description" : "name of the stock"
}
"date":{
"type" : "Date",
"Required" : "Yes",
"format" : "must be in EST format",
"description" : "filing date of the stock"
}
}