| java.lang.Object com.mockrunner.util.common.ClassUtil
ClassUtil | public class ClassUtil (Code) | | |
Method Summary | |
public static String | getArgumentName(Class argumentType) Returns a suitable argument name for arguments
of type argumentType . | public static String | getClassName(Class clazz) Returns the name of the specified class. | public static Class[] | getInheritanceHierarchy(Class clazz) Returns the inheritance hierarchy of the specified class.
The returned array includes all superclasses of the specified class
starting with the most general superclass, which is
java.lang.Object . | public static String | getPackageName(Class clazz) Returns the name of the package of the specified class. | public static boolean | isKeyword(String name) Returns if the specified string is a Java language
keyword. |
getArgumentName | public static String getArgumentName(Class argumentType)(Code) | | Returns a suitable argument name for arguments
of type argumentType . Simply takes
the class name and converts the starting characters
to lower case (by preserving one upper case character).
E.g. the result of JMSTestModule is
jmsTestModule .
If the specified argumentType is an array,
an "s" is appended to the string.
If the resulting string is a Java keyword, "Value"
is appended to the string (which is always the case with
primitive types).
Parameters: argumentType - the argument type a suitable mixed case argument name |
getClassName | public static String getClassName(Class clazz)(Code) | | Returns the name of the specified class. This method
only returns the class name without package information.
If the specified class represents a primitive type, the
name of the primitive type will be returned. If the
specified class is an array, [] will be
appended to the name (once for each dimension).
Parameters: clazz - the Class the class name |
getInheritanceHierarchy | public static Class[] getInheritanceHierarchy(Class clazz)(Code) | | Returns the inheritance hierarchy of the specified class.
The returned array includes all superclasses of the specified class
starting with the most general superclass, which is
java.lang.Object . The returned array also
includes the class itself as the last element. Implemented
interfaces are not included.
Parameters: clazz - the Class all superclasses, most general superclass first |
getPackageName | public static String getPackageName(Class clazz)(Code) | | Returns the name of the package of the specified class.
If the class has no package, an empty String will be
returned.
Parameters: clazz - the Class the package name |
isKeyword | public static boolean isKeyword(String name)(Code) | | Returns if the specified string is a Java language
keyword.
Parameters: name - the string true if it is a keyword,false otherwise |
|
|