Creating a new Java object automatically with correct data values
Creating a new Java object automatically with correct data values I'm wondering is there anyway in Java to create an object from a simple POJO automatically with correct data values? Lets say i have a simple POJO like this: public class POJO { private int intVar; private boolean booleanVar; private String stringVar; public POJO(int intVar, boolean booleanVar, String stringVar) { this.intVar = intVar; this.booleanVar = booleanVar; this.stringVar = stringVar; } //Geteru & Setteru... } So basically I want to know can i create an object from this class with some sorta method or something that would read the variables and their types and assign them with ANY values but the value would be correct for the variable data type. For example intVar should get ofcourse an integer and stringVar should get a String etc. This does not have to be the way to do this, what I am actually trying to achieve is im trying to automatically create a ...
