|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.lib.util.JavaVersions
public class JavaVersions
Utilities for dealing with different Java spec versions.
Field Summary | |
---|---|
static int |
VERSION
Java version; one of 2, 3, 4, 5, 6, or 7. |
Constructor Summary | |
---|---|
JavaVersions()
|
Method Summary | |
---|---|
static Throwable |
getCause(Throwable ex)
Return the cause of the given throwable. |
static Class[] |
getParameterizedTypes(Field f)
Collects the parameterized type declarations for a given field. |
static Class[] |
getParameterizedTypes(Method meth)
Collects the parameterized return type declarations for a given method. |
static Class |
getVersionSpecificClass(Class base)
Returns a version-specific instance of the specified class |
static Class |
getVersionSpecificClass(String base)
Obtains a subclass of the specific base class that is specific to the current version of Java in use. |
static Throwable |
initCause(Throwable ex,
Throwable cause)
Set the cause of the given throwable. |
static boolean |
isAnnotation(Class cls)
Return true if the given type is an annotation. |
static boolean |
isEnumeration(Class cls)
Return true if the given type is an enumeration. |
static void |
main(String[] args)
|
static boolean |
transferStackTrace(Throwable from,
Throwable to)
Transfer the stack from one throwable to another, or return false if it cannot be done, possibly due to an unsupported Java version. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int VERSION
Constructor Detail |
---|
public JavaVersions()
Method Detail |
---|
public static Class getVersionSpecificClass(Class base)
base
- the base class to check
getVersionSpecificClass(String)
public static Class getVersionSpecificClass(String base) throws ClassNotFoundException
VERSION
field, then each number in
decreasing order, until ending in the unqualified name.
For example, if we are using JDK 1.5.1, and we want to load
"org.apache.openjpa.lib.SomeClass", we will try to load the following
classes in order and return the first one that is successfully
found and loaded:
base
- the base name of the class to load
ClassNotFoundException
public static boolean isAnnotation(Class cls)
public static boolean isEnumeration(Class cls)
public static Class[] getParameterizedTypes(Field f)
public static Class[] getParameterizedTypes(Method meth)
public static boolean transferStackTrace(Throwable from, Throwable to)
public static Throwable getCause(Throwable ex)
public static Throwable initCause(Throwable ex, Throwable cause)
public static void main(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |