public class JavaVersions
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
VERSION
Java version; one of 2, 3, 4, 5, 6, or 7.
|
Constructor and Description |
---|
JavaVersions() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Throwable |
getCause(java.lang.Throwable ex)
Return the cause of the given throwable.
|
static java.lang.Class[] |
getParameterizedTypes(java.lang.reflect.Field f)
Collects the parameterized type declarations for a given field.
|
static java.lang.Class[] |
getParameterizedTypes(java.lang.reflect.Method meth)
Collects the parameterized return type declarations for a given method.
|
static java.lang.Class |
getVersionSpecificClass(java.lang.Class base)
Returns a version-specific instance of the specified class
|
static java.lang.Class |
getVersionSpecificClass(java.lang.String base)
Obtains a subclass of the specific base class that is
specific to the current version of Java in use.
|
static java.lang.Throwable |
initCause(java.lang.Throwable ex,
java.lang.Throwable cause)
Set the cause of the given throwable.
|
static boolean |
isAnnotation(java.lang.Class cls)
Return true if the given type is an annotation.
|
static boolean |
isEnumeration(java.lang.Class cls)
Return true if the given type is an enumeration.
|
static void |
main(java.lang.String[] args) |
static boolean |
transferStackTrace(java.lang.Throwable from,
java.lang.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.
|
public static java.lang.Class getVersionSpecificClass(java.lang.Class base)
base
- the base class to checkgetVersionSpecificClass(String)
public static java.lang.Class getVersionSpecificClass(java.lang.String base) throws java.lang.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 loadjava.lang.ClassNotFoundException
public static boolean isAnnotation(java.lang.Class cls)
public static boolean isEnumeration(java.lang.Class cls)
public static java.lang.Class[] getParameterizedTypes(java.lang.reflect.Field f)
public static java.lang.Class[] getParameterizedTypes(java.lang.reflect.Method meth)
public static boolean transferStackTrace(java.lang.Throwable from, java.lang.Throwable to)
public static java.lang.Throwable getCause(java.lang.Throwable ex)
public static java.lang.Throwable initCause(java.lang.Throwable ex, java.lang.Throwable cause)
public static void main(java.lang.String[] args)