I need to invoke a constructor using reflection to instantiate a class to produce multiple objects.
Here is what I am doing at the moment to create these objects:
for(int i = 0;i < num_objects;i++)
{
User A = new User(null, null, null);
loaded_data.add(A);
}
However, I wish to assume that I don't know what the constructor for User actually is, and therefore would like to use reflection to create x number of objects using null parameters so that they may be populated with their setters later.
Note loaded_data is an array of objects of type User.
I can invoke the Setters ok so defining the objects later is no problem, I'm just not sure how to create these objects using a constructor if we assume we don't know how many parameters the constructor takes.