public class

ReflectionHelper

extends Object
java.lang.Object
   ↳ com.pnfsoftware.jeb.util.reflect.ReflectionHelper

Class Overview

Helper routines using the Java Reflection API.

Summary

Public Constructors
ReflectionHelper()
Public Methods
static boolean hasNoArgConstructor(Class<?> c)
static <T> T instantiateSafe(Class<? extends T> c)
static Object invoke2(Method m, Object o, Object... args)
static Object newInstance2(Constructor<?> constructor)
static Class<?> reduceDimensions(Class<?> c)
Reduce dimensions of an array type.
static Class<?> removeDimensions(Class<?> c)
Remove dimensions of an array type.
static void set2(Field f, Object o, Object value)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ReflectionHelper ()

Public Methods

public static boolean hasNoArgConstructor (Class<?> c)

public static T instantiateSafe (Class<? extends T> c)

public static Object invoke2 (Method m, Object o, Object... args)

Throws
IllegalAccessException
IllegalArgumentException
InvocationTargetException

public static Object newInstance2 (Constructor<?> constructor)

Throws
IllegalAccessException
IllegalArgumentException
InstantiationException
InvocationTargetException

public static Class<?> reduceDimensions (Class<?> c)

Reduce dimensions of an array type. Careful, caveat for primitives:

  • non-array => non-array
  • Object[]...[] => Object
  • prim[]...[] => prim[]

Parameters
c a type

public static Class<?> removeDimensions (Class<?> c)

Remove dimensions of an array type.

  • non-array => non-array
  • type[]...[] => type

Parameters
c a type
Returns
  • the dimension-less type

public static void set2 (Field f, Object o, Object value)

Throws
IllegalAccessException
IllegalArgumentException