I have a class that looks like this:
public class UploadBean { protected UploadBean(Map<String,?> map){
To use reflection and create an object by calling the appropriate constructor, I wrote the code as follows:
Class<?> parTypes[] = new Class<?>[1]; parTypes[0] = Map.class; Constructor ct = format.getMappingBean().getConstructor(parTypes); Object[] argList = new Object[1]; argList[0] = map; Object retObj = ct.newInstance(argList);
This code crashes at runtime with a "No Such Method Exception". Now, how did I configure the parameter correctly? so what is the general argument of the map identified in the constructor?
source share