2

I'm using reflection in Java to call a Constructor.newInstance(). Some of the time I encounter primitive types -- which give me trouble when I try to use Class<T>.cast() from them.

Suppose I have this:

 Class<?> argumentClass = /* obtain class through reflection */;

Is there a way to convert argumentClass from primitive types (Integer.TYPE) to their boxed equivalent (Integer.class) when a primitive type is encountered?

Jason S
  • 184,598
  • 164
  • 608
  • 970
  • Let me suggest that you go up a level and use java.beans.Statement or Java.beans.Exoression. It does all this stuff for you. – user207421 Mar 19 '14 at 20:39

0 Answers0