I have a json data (that i can't change) stored in my nosql Mongodb database. This is how the data looks like :
{"scans" : {
"Bkav" : {
"detected" : false,
"version" : "1.3.0.4924",
"result" : null,
"update" : "20140214"
},
"MicroWorld" : {
"detected" : false,
"version" : "12.0.250.0",
"result" : null,
"update" : "20140216"
},
"nProtect" : {
"detected" : false,
"version" : "2014-02-16.01",
"result" : null,
"update" : "20140216"
}
}
}
what i'm trying to do is to create a rest webservice based on spring boot in order to retrieve the data stored in mongo, so i need to set up my models (based on the json format ) and this is what i came up with :
public class Scans
{
@Id
private String id;
private Bkav Bkav;
private NProtect nProtect;
private MicroWorld-eScan MicroWorld-eScan;
//getters and setters
@Override
public String toString()
{
return "ClassPojo [Bkav = "+Bkav+", nProtect = "+nProtect+", MicroWorld-eScan = "+MicroWorld-eScan+"]";
}
}
And for each scanner (Bkav, nProtect, MicroWorld-escan) i have this same model :
public class "scanner" //that may be one of the above names;
{
private String update;
private String result;
private String detected;
private String version;
//getters and setters
@Override
public String toString()
{
return "ClassPojo [update = "+update+", result = "+result+", detected = "+detected+", version = "+version+"]";
}
}
So is it possible to create only one class for all the scanners since i have more than the ones i listed in my question
Map<String, Scanner>