|
ProgramixGenericLib v5.0.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.programix.util.ReflectTools
public class ReflectTools
Commonly needed utilities for working with Java's Reflection mechanism.
| Nested Class Summary | |
|---|---|
static class |
ReflectTools.ReflectException
Used to indicate that something went wrong in one of the ReflectTools functions. |
| Method Summary | ||
|---|---|---|
static void |
checkType(Object obj,
Class<?> targetType)
Checks type of obj and throws an exception if it is not the specified type or if the reference is null. |
|
static void |
checkType(Object obj,
Class<?> targetType,
boolean allowNull)
Checks to see if the object pointed to by obj is an instance of the specified target type. |
|
static
|
construct(String className,
Class<T> targetType)
Used to lookup and instantiate the specified class using the class's zero-argument constuctor and to validate that it can be typecast into the target type. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <T> T construct(String className,
Class<T> targetType)
throws ReflectTools.ReflectException
className - the class to lookup and constructtargetType - the type to check to see if the constructed
object can be cast into.
ReflectTools.ReflectException - if the requested class can not
be found, or if it doesn't have a public zero-argument constructor,
or if the constructed object can't be typecast into the target type,
or if either parameter is null.
public static void checkType(Object obj,
Class<?> targetType,
boolean allowNull)
throws ReflectTools.ReflectException
ReflectTools.ReflectException
public static void checkType(Object obj,
Class<?> targetType)
throws ReflectTools.ReflectException
checkType(Object, Class, boolean) with allowNull
set to false.
ReflectTools.ReflectException
|
ProgramixGenericLib v5.0.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||