org.apache.openjpa.lib.util
public class JavaVersions extends 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 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.
|
public static Class getVersionSpecificClass(Class base)
base
- the base class to checkgetVersionSpecificClass(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 loadClassNotFoundException
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 initCause(Throwable ex, Throwable cause)
public static void main(String[] args)
Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.