com.mockrunner.util.common
Class ClassUtil

java.lang.Object
  extended bycom.mockrunner.util.common.ClassUtil

public class ClassUtil
extends java.lang.Object


Constructor Summary
ClassUtil()
           
 
Method Summary
static java.lang.String getArgumentName(java.lang.Class argumentType)
          Returns a suitable argument name for arguments of type argumentType.
static java.lang.String getClassName(java.lang.Class clazz)
          Returns the name of the specified class.
static java.lang.String getPackageName(java.lang.Class clazz)
          Returns the name of the package of the specified class.
static boolean isKeyword(java.lang.String name)
          Returns if the specified string is a Java language keyword.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassUtil

public ClassUtil()
Method Detail

getPackageName

public static java.lang.String getPackageName(java.lang.Class clazz)
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
Returns:
the package name

getClassName

public static java.lang.String getClassName(java.lang.Class clazz)
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
Returns:
the class name

isKeyword

public static boolean isKeyword(java.lang.String name)
Returns if the specified string is a Java language keyword.

Parameters:
name - the string
Returns:
true if it is a keyword, false otherwise

getArgumentName

public static java.lang.String getArgumentName(java.lang.Class argumentType)
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 (what is always the case with primitive types).

Parameters:
argumentType - the argument type
Returns:
a suitable mixed case argument name