Package com.jogamp.common.util
Class ReflectionUtil
java.lang.Object
com.jogamp.common.util.ReflectionUtil
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classConvenient Method access class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final ObjectcallMethod(Object instance, Method method, Object... args) static final ObjectcallStaticMethod(String clazzName, String methodName, Class<?>[] argTypes, Object[] args, ClassLoader cl) static final ObjectcreateInstance(Class<?> clazz, Class<?>[] cstrArgTypes, Object... cstrArgs) static final ObjectcreateInstance(Class<?> clazz, Object... cstrArgs) static final ObjectcreateInstance(Constructor<?> cstr, Object... cstrArgs) static final ObjectcreateInstance(String clazzName, Class<?>[] cstrArgTypes, Object[] cstrArgs, ClassLoader cl) static final ObjectcreateInstance(String clazzName, ClassLoader cl) static final ObjectcreateInstance(String clazzName, Object[] cstrArgs, ClassLoader cl) static final Class<?>getClass(String clazzName, boolean initializeClazz, ClassLoader cl) Loads and returns the class or null.static final Constructor<?>getConstructor(Class<?> clazz, Class<?>... cstrArgTypes) Returns a compatible constructor if available, otherwise throws an exception.static final Constructor<?>getConstructor(String clazzName, Class<?>[] cstrArgTypes, boolean initializeClazz, ClassLoader cl) static final Constructor<?>getConstructor(String clazzName, ClassLoader cl) static StringBuilderstatic final Methodstatic final MethodgetMethod(String clazzName, String methodName, Class<?>[] argTypes, ClassLoader cl) static final booleanimplementationOf(Class<?> clazz, String faceName) static final booleanimplementationOf(Object obj, String faceName) static final booleaninstanceOf(Class<?> clazz, String clazzName) static final booleaninstanceOf(Object obj, String clazzName) static booleanisAWTComponent(Class<?> clazz) static booleanisAWTComponent(Object target) static final booleanisClassAvailable(String clazzName, ClassLoader cl) Returns true only if the class could be loaded.static void
-
Field Details
-
DEBUG
public static final boolean DEBUG -
DEBUG_STATS_FORNAME
public static final boolean DEBUG_STATS_FORNAME
-
-
Constructor Details
-
ReflectionUtil
public ReflectionUtil()
-
-
Method Details
-
resetForNameCount
public static void resetForNameCount() -
getForNameStats
-
isClassAvailable
Returns true only if the class could be loaded. -
getClass
public static final Class<?> getClass(String clazzName, boolean initializeClazz, ClassLoader cl) throws JogampRuntimeException Loads and returns the class or null. -
getConstructor
public static final Constructor<?> getConstructor(String clazzName, Class<?>[] cstrArgTypes, boolean initializeClazz, ClassLoader cl) throws JogampRuntimeException - Parameters:
initializeClazz- TODO- Throws:
JogampRuntimeException- if the constructor can not be delivered.
-
getConstructor
public static final Constructor<?> getConstructor(Class<?> clazz, Class<?>... cstrArgTypes) throws JogampRuntimeException Returns a compatible constructor if available, otherwise throws an exception.It first attempts to get the specific Constructor using the given
cstrArgTypes. If this fails w/NoSuchMethodException, a compatible Constructor is being looked-up w/ with parameter types assignable from the givencstrArgs.- Throws:
JogampRuntimeException- if the constructor can not be delivered.
-
getConstructor
public static final Constructor<?> getConstructor(String clazzName, ClassLoader cl) throws JogampRuntimeException - Throws:
JogampRuntimeException
-
createInstance
public static final Object createInstance(Constructor<?> cstr, Object... cstrArgs) throws JogampRuntimeException, RuntimeException - Throws:
JogampRuntimeException- if the instance can not be created.RuntimeException
-
createInstance
public static final Object createInstance(Class<?> clazz, Class<?>[] cstrArgTypes, Object... cstrArgs) throws JogampRuntimeException, RuntimeException - Throws:
JogampRuntimeException- if the instance can not be created.RuntimeException
-
createInstance
public static final Object createInstance(Class<?> clazz, Object... cstrArgs) throws JogampRuntimeException, RuntimeException -
createInstance
public static final Object createInstance(String clazzName, Class<?>[] cstrArgTypes, Object[] cstrArgs, ClassLoader cl) throws JogampRuntimeException, RuntimeException -
createInstance
public static final Object createInstance(String clazzName, Object[] cstrArgs, ClassLoader cl) throws JogampRuntimeException, RuntimeException -
createInstance
public static final Object createInstance(String clazzName, ClassLoader cl) throws JogampRuntimeException, RuntimeException -
instanceOf
-
instanceOf
-
implementationOf
-
implementationOf
-
isAWTComponent
-
isAWTComponent
-
getMethod
public static final Method getMethod(Class<?> clazz, String methodName, Class<?>... argTypes) throws JogampRuntimeException, RuntimeException - Throws:
JogampRuntimeException- if the Method can not be found.RuntimeException
-
getMethod
public static final Method getMethod(String clazzName, String methodName, Class<?>[] argTypes, ClassLoader cl) throws JogampRuntimeException, RuntimeException - Throws:
JogampRuntimeException- if the Method can not be found.RuntimeException
-
callMethod
public static final Object callMethod(Object instance, Method method, Object... args) throws JogampRuntimeException, RuntimeException - Parameters:
instance- may be null in case of a static methodmethod- the method to be calledargs- the method arguments- Returns:
- the methods result, maybe null if void
- Throws:
JogampRuntimeException- if call failsRuntimeException- if call fails
-
callStaticMethod
public static final Object callStaticMethod(String clazzName, String methodName, Class<?>[] argTypes, Object[] args, ClassLoader cl) throws JogampRuntimeException, RuntimeException - Throws:
JogampRuntimeException- if the instance can not be created.RuntimeException
-