java.lang.Object |
↳ |
com.pnfsoftware.jeb.util.reflect.ReflectionHelper |
Class Overview
Helper routines using the Java Reflection API.
Summary
Public Methods |
static
Object
|
get2(Field f, Object o)
|
static
boolean
|
hasNoArgConstructor(Class<?> c)
|
static
<T>
T
|
instantiateSafe(Class<? extends T> c)
|
static
Object
|
invoke2(Method m, Object o, Object... args)
|
static
<T>
boolean
|
isInstance(Object o, Collection<Class<? extends T>> classObjects)
|
static
boolean
|
isInstance(Object o, Class...<?> classObjects)
|
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)
|
static
boolean
|
subtypeOf(Class<?> c, Class<?> parent)
Determine if a type is a descendant of the provided ancestor.
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
Public Constructors
public
ReflectionHelper
()
Public Methods
public
static
Object
get2
(Field f, Object o)
Throws
IllegalAccessException
| |
IllegalArgumentException
| |
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
boolean
isInstance
(Object o, Collection<Class<? extends T>> classObjects)
Parameters
o |
the object to be tested |
classObjects |
a collection of Class objects |
Returns
- true if o can be cast to one of the provided class objects
public
static
boolean
isInstance
(Object o, Class...<?> classObjects)
Parameters
o |
the object to be tested |
classObjects |
a collection of Class objects |
Returns
- true if o can be cast to one of the provided class objects
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[]
public
static
Class<?>
removeDimensions
(Class<?> c)
Remove dimensions of an array type.
- non-array => non-array
- type[]...[] => type
public
static
void
set2
(Field f, Object o, Object value)
Throws
IllegalAccessException
| |
IllegalArgumentException
| |
public
static
boolean
subtypeOf
(Class<?> c, Class<?> parent)
Determine if a type is a descendant of the provided ancestor.
Parameters
c |
a type (class or interface) |
parent |
a candidate ancestor type (class or interface) |