| |
|
| java.lang.Object junitx.ddtunit.util.ClassAnalyser
ClassAnalyser | public class ClassAnalyser (Code) | | This example is taken from Thinking in Java secd. ed. (p.680f) This class
used reflection to show all the methods of a class, even if the methods are
defined in the base class.
author: jgellien |
classPackage | public static String classPackage(Object obj)(Code) | | Extract package from object instance
package name of object instance |
createPrimitiveArray | public static Object createPrimitiveArray(Object value)(Code) | | Convert an array of object to its primitive counterpart. Values of null
will be replaced by the primitive default value.
Parameters: value - - array of Object to convert array of primitive counterpart |
findMethodByParams | public static Object findMethodByParams(String className, String methodName, Class[] args)(Code) | | Find a Constructor/Method of class className by using the argument list
args and try to vary arguments which could be of primitive type.
The args list only contains classes.
Parameters: className - Parameters: methodName - Parameters: args - Method/Constructor object |
getAllMethods | public static String[] getAllMethods(String qualifiedClassName)(Code) | | Put all method names of the class qualifiedClassName into a String array
and return it.
Parameters: qualifiedClassName - Description of the Parameter array of all method names of the class to analyse throws: RuntimeException - ClassAnalyserException if an error occures |
getPrimitiveArrayBaseType | public static Class getPrimitiveArrayBaseType(Class clazz)(Code) | | Parameters: clazz - primitive clazz |
getPrimitiveClass | public static Class getPrimitiveClass(Class checkClass)(Code) | | Retrieve primitove type of specified clazz
Parameters: checkClass - to retrieve associated primitive type from associated primitive type or null if non exists |
getSelectedField | public static Field getSelectedField(String qualifiedClassName, String searchTerm)(Code) | | Search for exact match of searchTerm in the list of declared fields of
the class qualifiedClassName.
Parameters: qualifiedClassName - Description of the Parameter Parameters: searchTerm - Description of the Parameter Field that was found or null if field does not exists throws: RuntimeException - ClassAnalyserException if an error occures |
getShortName | public static String getShortName(Object obj)(Code) | | Extract simple class name without package information
Parameters: obj - object to analyse class name |
getShortName | public static String getShortName(Class className)(Code) | | Extract simple class name without package information
Parameters: className - to analyse name without package extension |
getShortName | public static String getShortName(String className)(Code) | | Extract simple class name without package information
Parameters: className - qualified class name to analyse class name |
hasPrimitive | public static boolean hasPrimitive(Class checkClass)(Code) | | Verify if provided clazz has primitive type
Parameters: checkClass - to look for associated primitive type true if primitive type is found |
main | public static void main(String[] args)(Code) | | The main program for the ShowMethods class
Parameters: args - The command line arguments |
showAllFields | public static void showAllFields(String qualifiedClassName)(Code) | | Display all attributes/fields of class quaifiedClassName to the
configured appender specified by Log4j
Parameters: qualifiedClassName - name of class under analysis throws: RuntimeException - ClassAnalyserException if an error occures |
showAllMethods | public static void showAllMethods(String qualifiedClassName)(Code) | | Display all methods of class quaifiedClassName to the configured appender
specified by Log4j
Parameters: qualifiedClassName - name of class under analysis throws: RuntimeException - ClassAnalyserException if an error occures |
showSelectedFields | public static void showSelectedFields(String qualifiedClassName, String searchTerm)(Code) | | Display all attributes/fields of class quaifiedClassName matching
searchTerm to the configured appender specified by Log4j
Parameters: qualifiedClassName - name of class under analysis Parameters: searchTerm - match string to check against throws: RuntimeException - ClassAnalyserException if an error occures |
showSelectedMethods | public static void showSelectedMethods(String qualifiedClassName, String searchTerm)(Code) | | Display all constructors and methods of qualifiedClassName class which
match with searchTerm. Output is set to Log4J Info level of this
classes Logger.
Parameters: qualifiedClassName - Name of class to analyse Parameters: searchTerm - Match term for methods to display throws: RuntimeException - ClassAnalyserException if an error occures |
|
|
|