You’re using the wrong constant to check for Long primitives – use Long.TYPE
, each other primitive type can be found with a similarly named constant on the wrapper. eg: Byte.TYPE
, Character.TYPE
, etc.
More Related Contents:
- Dynamically find the class that represents a primitive Java type
- Integer.class vs int.class
- Java Reflection: How to get the name of a variable?
- How to load Classes at runtime from a folder or JAR?
- What’s the difference between primitive and reference types?
- Run piece of code contained in a String
- What could cause java.lang.reflect.InvocationTargetException?
- How to instantiate an inner class with reflection in Java?
- Printing all variables value from a class
- How to call a superclass method using Java reflection
- Invoking a static method using reflection
- Method to dynamically load java class files
- Set private field value with reflection
- Is it possible to create an instance of inner class using Java Reflection?
- How does double to int cast work in Java
- How to get the Array Class for a given Class in Java?
- How to have Java method return generic list of any type?
- What is the security risk of object reflection?
- Java Reflection: Getting fields and methods in declaration order
- Are primitive datatypes thread-safe in Java
- Difference between Loading a class using ClassLoader and Class.forName
- Java toString() using reflection?
- How to get the generic type at runtime?
- Java: accessing private constructor with type parameters
- Why is reflection slow?
- Java introspection and reflection
- Using reflection in Java to create a new instance with the reference variable type set to the new instance class name?
- How to invoke a method in java using reflection
- Simple way to get wrapper class type in Java
- Wrong number of arguments error when invoking a method