|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.claritysys.util.Java
public final class Java
A collection of utility methods dealing with Java class issues.
| Constructor Summary | |
|---|---|
Java()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
getDeclaration(java.lang.Class type)
Return a proper Java type declaration given a class. |
static java.lang.String |
getPackageName(java.lang.Class theClass)
Return the package name for the given class, null if it isn't in a package. |
static java.lang.String |
getPackageName(java.lang.String theClass)
Return the name of the package for the given class, or null if it isn't in a package. |
static java.lang.String |
getShortName(java.lang.Class type)
Get the "short" name of the given class, ie the name without the package prefix. |
static java.lang.String |
getShortName(java.lang.String name)
Get the "short" name of the given class, ie the name without the package prefix. |
static java.lang.String |
getShortNameInternal(java.lang.String name)
Get the "short" name of the given class, ie the name without the package prefix, based on the input String being in Java internal format, using "/" instead of "." as a separator. |
static java.lang.String |
getVmSignature(java.lang.Class type)
Return the VM type signature for the given class. |
static java.lang.String |
getVmSignature(java.lang.Class[] paramTypes,
java.lang.Class returnType)
Generate a Virtual Machine formed method signature given the classes of the parameters and return type, as from invoking Method.getParameterTypes()/Method.getReturnType (). |
static void |
getVmSignature(java.lang.Class type,
java.lang.StringBuffer s)
Convert the given Class type to an internal signature, such as "I" for Integer.TYPE, or "Ljava/lang/String;" for String.class. |
static java.lang.Class |
toAbstractClass(java.lang.Class implClass)
Return the first abstract superclass of the class, or the class itself if it is abstract. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Java()
| Method Detail |
|---|
public static java.lang.String getDeclaration(java.lang.Class type)
This is needed because a class may represent an array, in which case its name is "[b foobar" or similar.
The returned declaration String is suitable for generating Java source code.
type - A Java class.
public static java.lang.String getShortName(java.lang.Class type)
If the class is not in a package its name is returned, otherwise the package name is stripped off and the short name is returned.
Array types do not have a short name.
type - A Java class.
public static java.lang.String getShortName(java.lang.String name)
If the class is not in a package its name is returned, otherwise the package name is stripped off and the short name is returned.
Array types do not have a short name.
name - The short or full classname to convert to simply a short
name.
public static java.lang.String getShortNameInternal(java.lang.String name)
If the class is not in a package its name is returned, otherwise the package name is stripped off and the short name is returned.
Array types do not have a short name.
name - The short or full classname to convert to simply a short
name.
public static java.lang.Class toAbstractClass(java.lang.Class implClass)
This is useful when handed an implementation of a class, and it is desired to find the abstract class being implemented.
implClass - A Java class.
public static java.lang.String getPackageName(java.lang.Class theClass)
theClass - The Class for which to compute a package name.
public static java.lang.String getPackageName(java.lang.String theClass)
theClass - The class name as a String.
public static java.lang.String getVmSignature(java.lang.Class[] paramTypes,
java.lang.Class returnType)
For example, this will translate the reflected Method "System.out.println (String)" into "(Ljava/lang/String;)V".
paramTypes - Non-null but possibly zero length array of Class
for types of parameters.returnType - Non-null Class describing method return type.
public static void getVmSignature(java.lang.Class type,
java.lang.StringBuffer s)
type - The type to convert, a Class or Integer.TYPE, etc.s - The StringBuffer to append to.public static java.lang.String getVmSignature(java.lang.Class type)
type - An object or primitive class type.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||