Class JavaTypeHelper
java.lang.Object
com.sun.jdo.spi.persistence.utility.JavaTypeHelper
- Direct Known Subclasses:
JavaClassWriterHelper
This is a helper class which provides some basic java type convenience
methods: extraction of a package from a fully qualified class name,
extraction of a short (non-qualified) name from a fully qualified class
name, and various wrapper and primitive type methods.
- Author:
- Rochelle Raccah
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetPackageName(String className) Returns the package portion of the specified classstatic ClassgetPrimitiveClass(String primitiveName) Returns the primitive class associated with the supplied primitive type name.static StringgetPrimitiveName(Class wrapper) Returns the name of the primitive type associated with the supplied wrapper class.static StringgetShortClassName(String className) Returns the name of a class without the package name.static ClassgetWrapperClass(Class primitive) Returns the wrapper class associated with the supplied primitive class.static StringgetWrapperName(String primitiveName) Returns the name of the wrapper class associated with the supplied primitive type name.static BooleanvalueOf(boolean flag) Returns the Boolean wrapper object for true or false corresponding to the supplied argument.
-
Constructor Details
-
JavaTypeHelper
public JavaTypeHelper()
-
-
Method Details
-
getPackageName
Returns the package portion of the specified class- Parameters:
className- the name of the class from which to extract the package- Returns:
- package portion of the specified class
-
getShortClassName
Returns the name of a class without the package name. For example: if input = "java.lang.Object" , then output = "Object".- Parameters:
className- fully qualified classname
-
getWrapperClass
Returns the wrapper class associated with the supplied primitive class.- Parameters:
primitive- the primitive class to be used for lookup.- Returns:
- the associated wrapper class.
-
getPrimitiveClass
Returns the primitive class associated with the supplied primitive type name.- Parameters:
primitiveName- the name of the primitive to be used for lookup.- Returns:
- the associated primitive class.
-
getWrapperName
Returns the name of the wrapper class associated with the supplied primitive type name.- Parameters:
primitiveName- the name of the primitive to be used for lookup.- Returns:
- the associated wrapper class name.
-
getPrimitiveName
Returns the name of the primitive type associated with the supplied wrapper class.- Parameters:
wrapper- the wrapper class to be used for lookup.- Returns:
- the associated primitive type name.
-
valueOf
Returns the Boolean wrapper object for true or false corresponding to the supplied argument. This is to provide a convenience method for this conversion but to prevent calling the Boolean constructor which has been determined to be unnecessary and a performance problem. JDK 1.4 provides such a method, but some of our code still works with JDK 1.3.- Parameters:
flag- the primitive boolean object to be translated to a Boolean wrapper.- Returns:
- the associated true/false shared wrapper object
-