| java.lang.Object org.apache.openjpa.lib.util.JavaVersions
JavaVersions | public class JavaVersions (Code) | | Utilities for dealing with different Java spec versions.
author: Abe White |
Field Summary | |
final public static int | VERSION Java version; one of 2, 3, 4, 5, 6, or 7. |
VERSION | final public static int VERSION(Code) | | Java version; one of 2, 3, 4, 5, 6, or 7.
|
getParameterizedTypes | public static Class[] getParameterizedTypes(Field f)(Code) | | Collects the parameterized type declarations for a given field.
|
getParameterizedTypes | public static Class[] getParameterizedTypes(Method meth)(Code) | | Collects the parameterized return type declarations for a given method.
|
getVersionSpecificClass | public static Class getVersionSpecificClass(String base) throws ClassNotFoundException(Code) | | Obtains a subclass of the specific base class that is
specific to the current version of Java in use. The
heuristic for the class name to load will be that OpenJPA
first checks for the name of the class with the current
setting of the
JavaVersions.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:
- org.apache.openjpa.lib.SomeClass5
- org.apache.openjpa.lib.SomeClass4
- org.apache.openjpa.lib.SomeClass3
- org.apache.openjpa.lib.SomeClass2
- org.apache.openjpa.lib.SomeClass1
- org.apache.openjpa.lib.SomeClass
Parameters: base - the base name of the class to load the subclass appropriate for the current Java version |
isAnnotation | public static boolean isAnnotation(Class cls)(Code) | | Return true if the given type is an annotation.
|
isEnumeration | public static boolean isEnumeration(Class cls)(Code) | | Return true if the given type is an enumeration.
|
transferStackTrace | public static boolean transferStackTrace(Throwable from, Throwable to)(Code) | | Transfer the stack from one throwable to another, or return
false if it cannot be done, possibly due to an unsupported Java version.
|
|
|