Package org.apache.openjpa.lib.util
Class ClassUtil
- java.lang.Object
-
- org.apache.openjpa.lib.util.ClassUtil
-
public final class ClassUtil extends java.lang.Object
Various helper methods to deal with Classes
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getClassName(java.lang.Class cls)
Return only the class name, without package.static java.lang.String
getClassName(java.lang.String fullName)
Return only the class name.static java.lang.String
getPackageName(java.lang.Class cls)
Return only the package, or empty string if none.static java.lang.String
getPackageName(java.lang.String fullName)
Return only the package, or empty string if none.static java.lang.Class
toClass(java.lang.String str, boolean resolve, java.lang.ClassLoader loader)
Return the class for the given string, correctly handling primitive types.static java.lang.Class
toClass(java.lang.String str, java.lang.ClassLoader loader)
Return the class for the given string, correctly handling primitive types.
-
-
-
Method Detail
-
toClass
public static java.lang.Class toClass(java.lang.String str, java.lang.ClassLoader loader)
Return the class for the given string, correctly handling primitive types. If the given class loader is null, the context loader of the current thread will be used.- Throws:
java.lang.RuntimeException
- on load error
-
toClass
public static java.lang.Class toClass(java.lang.String str, boolean resolve, java.lang.ClassLoader loader)
Return the class for the given string, correctly handling primitive types. If the given class loader is null, the context loader of the current thread will be used.- Throws:
java.lang.RuntimeException
- on load error
-
getClassName
public static java.lang.String getClassName(java.lang.Class cls)
Return only the class name, without package.
-
getClassName
public static java.lang.String getClassName(java.lang.String fullName)
Return only the class name.
-
getPackageName
public static java.lang.String getPackageName(java.lang.Class cls)
Return only the package, or empty string if none.
-
getPackageName
public static java.lang.String getPackageName(java.lang.String fullName)
Return only the package, or empty string if none.
-
-