summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/util/ReflectionUtil.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-04-19 01:40:20 +0200
committerSven Gothel <[email protected]>2010-04-19 01:40:20 +0200
commita01cb3d59715a41153380f1977ec75263b762dc6 (patch)
tree0fc31f9e9b60d23c088ae8049b5c8d456398bc9f /src/java/com/jogamp/common/util/ReflectionUtil.java
parentc7630f35befa1b8dbd365984f08c4efbc04488c1 (diff)
Importing files from JOGL (preserving history)
git mv src/nativewindow/native/JVM_Tool.c src/native/common/JVM_Tool.c git mv src/nativewindow/classes/com/jogamp/nativewindow/impl/NativeLibLoaderBase.java src/java/com/jogamp/common/jvm/JNILibLoaderBase.java git mv src/nativewindow/classes/com/jogamp/nativewindow/impl/jvm/JVMUtil.java src/java/com/jogamp/common/jvm/JVMUtil.java git mv src/nativewindow/classes/com/jogamp/nativewindow/impl/NWReflection.java src/java/com/jogamp/common/util/ReflectionUtil.java Adding own JogampRuntimeException and Debug class
Diffstat (limited to 'src/java/com/jogamp/common/util/ReflectionUtil.java')
-rw-r--r--src/java/com/jogamp/common/util/ReflectionUtil.java31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/java/com/jogamp/common/util/ReflectionUtil.java b/src/java/com/jogamp/common/util/ReflectionUtil.java
index 9bac947..f3708aa 100644
--- a/src/java/com/jogamp/common/util/ReflectionUtil.java
+++ b/src/java/com/jogamp/common/util/ReflectionUtil.java
@@ -34,21 +34,22 @@
* facility.
*/
-package com.jogamp.nativewindow.impl;
+package com.jogamp.common.util;
import java.lang.reflect.*;
-import javax.media.nativewindow.*;
+import com.jogamp.common.JogampRuntimeException;
+import com.jogamp.common.impl.Debug;
-public final class NWReflection {
+public final class ReflectionUtil {
- public static final boolean DEBUG = Debug.debug("NWReflection");
+ public static final boolean DEBUG = Debug.debug("ReflectionUtil");
/**
* Returns true only if the class could be loaded.
*/
public static final boolean isClassAvailable(String clazzName) {
try {
- return null != Class.forName(clazzName, false, NWReflection.class.getClassLoader());
+ return null != Class.forName(clazzName, false, ReflectionUtil.class.getClassLoader());
} catch (ClassNotFoundException e) {
return false;
}
@@ -67,22 +68,22 @@ public final class NWReflection {
}
private static Class getClassImpl(String clazzName, boolean initialize) throws ClassNotFoundException {
- return Class.forName(clazzName, initialize, NWReflection.class.getClassLoader());
+ return Class.forName(clazzName, initialize, ReflectionUtil.class.getClassLoader());
}
/**
- * @throws NativeWindowException if the constructor can not be delivered.
+ * @throws JogampRuntimeException if the constructor can not be delivered.
*/
public static final Constructor getConstructor(String clazzName, Class[] cstrArgTypes) {
try {
return getConstructor(getClassImpl(clazzName, true), cstrArgTypes);
} catch (ClassNotFoundException ex) {
- throw new NativeWindowException(clazzName + " not available", ex);
+ throw new JogampRuntimeException(clazzName + " not available", ex);
}
}
/**
- * @throws NativeWindowException if the constructor can not be delivered.
+ * @throws JogampRuntimeException if the constructor can not be delivered.
*/
public static final Constructor getConstructor(Class clazz, Class[] cstrArgTypes) {
try {
@@ -95,7 +96,7 @@ public final class NWReflection {
args+= ", ";
}
}
- throw new NativeWindowException("Constructor: '" + clazz + "(" + args + ")' not found", ex);
+ throw new JogampRuntimeException("Constructor: '" + clazz + "(" + args + ")' not found", ex);
}
}
@@ -104,17 +105,17 @@ public final class NWReflection {
}
/**
- * @throws NativeWindowException if the instance can not be created.
+ * @throws JogampRuntimeException if the instance can not be created.
*/
public static final Object createInstance(Class clazz, Class[] cstrArgTypes, Object[] cstrArgs) {
try {
return getConstructor(clazz, cstrArgTypes).newInstance(cstrArgs);
} catch (InstantiationException ex) {
- throw new NativeWindowException("can not create instance of class "+clazz, ex);
+ throw new JogampRuntimeException("can not create instance of class "+clazz, ex);
} catch (InvocationTargetException ex) {
- throw new NativeWindowException("can not create instance of class "+clazz, ex);
+ throw new JogampRuntimeException("can not create instance of class "+clazz, ex);
} catch (IllegalAccessException ex) {
- throw new NativeWindowException("can not create instance of class "+clazz, ex);
+ throw new JogampRuntimeException("can not create instance of class "+clazz, ex);
}
}
@@ -130,7 +131,7 @@ public final class NWReflection {
try {
return createInstance(getClassImpl(clazzName, true), cstrArgTypes, cstrArgs);
} catch (ClassNotFoundException ex) {
- throw new NativeWindowException(clazzName + " not available", ex);
+ throw new JogampRuntimeException(clazzName + " not available", ex);
}
}