Java - Reflection - getConstructor() call with primitive datatypes?

(see title)

Currently I am using this:

Class clazz = Class.forName(className);
 Class[] parameter = new Class[4];
 parameter[0] = String.class;
 parameter[1] = Integer.class;
 Object args1[] = new Object[] { args[1], args[2] };
 Constructor constructor = clazz.getConstructor(parameter);
 Type type = (Type) constructor.newInstance(args1);
 

Instead of Integer.class, I would like to use primitive datatypes such as int.
Is this possible or another way around this?

Thanks in advance,
Christian

I believe this should work:

parameter[1] = Integer.TYPE;

There are similar fields on the other primitive wrapper classes.

Thanks :slight_smile: it works