net.jbeans.lang
Class ClassUtil

java.lang.Object
  extended bynet.jbeans.lang.ClassUtil

public final class ClassUtil
extends java.lang.Object

This class defines various method for examining class objcts.

Version:
$Revision: 1.1.1.1 $
Author:
Masahiro Takatsuka (masa@jbeans.net)

Method Summary
static java.lang.String capitalize(java.lang.String name)
          Utility method to take a string and convert it to normal Java Class name capitalization.
static java.lang.String decapitalize(java.lang.String name)
          Utility method to take a string and convert it to normal Java variable name capitalization.
static java.lang.String forceDecapitalize(java.lang.String name)
          Utility method to take a string and convert it to normal Java variable name capitalization.
static java.lang.String formatMethodSignature(java.lang.reflect.Method method)
          Returns a string that formats the method signature for desplay
static java.lang.String formatMethodSignatureWithoutReturnType(java.lang.reflect.Method method)
          Returns a string that formats the method signature for desplay
static java.lang.String formatParameters(java.lang.reflect.Method method)
          Returns a string that formats the parameters for a methods for display
static java.lang.String formatReturnType(java.lang.reflect.Method method)
          Returns a string that formats the parameters for a methods for display
static java.lang.Class getClass(java.lang.String name)
           
static java.lang.Class[] getClasses(java.lang.String[] names)
           
static java.lang.String[] getClassNames(java.lang.Class[] classes)
           
static java.lang.String getCompilableName(java.lang.Class clazz)
          Returns the class name, which can be inserted in java source code, from a fully-qualified class name.
static java.lang.String getCompilableName(java.lang.String fullName)
          Returns the class name, which can be inserted in java source code, from a fully-qualified class name.
static java.lang.String[] getCompilableNames(java.lang.Class[] classes)
          Returns the class name, which can be inserted in java source code, from a fully-qualified class name.
static int getDimensionOfArray(java.lang.Class c)
          Return the dimensino of array if class c is an array.
static java.lang.reflect.Method getMethod(java.lang.Object obj, java.lang.String methodName, java.lang.Class[] argTypes)
           
static java.lang.Class getPrimitiveClass(java.lang.String primitive)
          Returns a corresponding class of the specified primitive class.
static java.lang.String getRootDirectoryName(java.lang.String fullPath, java.lang.String classFileName)
          Returns the name of the root directory where the specified class resides.
static java.lang.String getRootName(java.lang.Class clazz)
          Returns the name of the root class from a full class path.
static java.lang.String getRootName(java.lang.String fullName)
          Returns the name of the root class from a full class path.
static java.lang.Class getWrapperClass(java.lang.Class primitiveClass)
          Returns a corresponding wrapper class of the specified primitive class.
static java.lang.Class[] getWrapperClasses(java.lang.Class[] primitiveClasses)
          Converts Class objects representing primitive classes into corresponding wrapper classs.
static boolean is2DArray(java.lang.Class c)
          Return true if class c is a 2-D array.
static boolean isArray(java.lang.Class c)
          Return true if class c is an array.
static boolean isArray(java.lang.Object o)
          Return true if object o is an array.
static boolean isAssignable(java.lang.Class source, java.lang.Class target)
          Return true if class source can be casted to class target.
static boolean isSubclass(java.lang.Class class_a, java.lang.Class class_b)
          Return true if class a is either equivalent to class b, or if class a is a subclass of class b.
static java.lang.Object makeObjectPerform(java.lang.Object obj, java.lang.String methodname)
          Sends a methodname message to the receiver.
static java.lang.Object makeObjectPerform(java.lang.Object obj, java.lang.String methodname, java.lang.Object[] args)
          Sends the name of a method as a message to the receiver.
static java.lang.Object makeObjectPerform(java.lang.Object obj, java.lang.String methodname, java.lang.Object[] args, java.lang.Class[] argTypes)
          Sends the name of a method as a message to the receiver.
static java.lang.Thread makeObjectPerformInThread(java.lang.Object object, java.lang.reflect.Method method)
          Sends a methodname message to the receiver.
static java.lang.Thread makeObjectPerformInThread(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object[] args)
          Sends a methodname message to the receiver.
static java.lang.Thread makeObjectPerformInThread(java.lang.Object object, java.lang.String methodname)
          Sends a methodname message to the receiver.
static java.lang.Thread makeObjectPerformInThread(java.lang.Object object, java.lang.String methodname, java.lang.Object[] args)
          Sends a methodname message to the receiver.
static java.lang.Thread makeObjectPerformInThread(java.lang.Object object, java.lang.String methodname, java.lang.Object[] args, java.lang.Class[] argTypes)
          Sends a methodname message to the receiver.
static java.lang.Thread makeObjectPerformInThread(java.lang.ThreadGroup group, java.lang.Object object, java.lang.reflect.Method method, java.lang.Object[] args)
          Sends a methodname message to the receiver.
static java.lang.Thread makeObjectPerformInThread(java.lang.ThreadGroup group, java.lang.Object object, java.lang.reflect.Method method, java.lang.Object[] args, boolean forced)
          Sends a methodname message to the receiver.
static java.lang.Thread makeObjectPerformInThread(java.lang.ThreadGroup group, java.lang.Object object, java.lang.String methodname, java.lang.Object[] args)
          Sends a methodname message to the receiver.
static java.lang.Thread makeObjectPerformInThread(java.lang.ThreadGroup group, java.lang.Object object, java.lang.String methodname, java.lang.Object[] args, boolean forced)
          Sends a methodname message to the receiver.
static java.lang.Thread makeObjectPerformInThread(java.lang.ThreadGroup group, java.lang.Object object, java.lang.String methodname, java.lang.Object[] args, java.lang.Class[] argTypes)
          Sends a methodname message to the receiver.
static java.lang.Thread makeObjectPerformInThread(java.lang.ThreadGroup group, java.lang.Object object, java.lang.String methodname, java.lang.Object[] args, java.lang.Class[] argTypes, boolean forced)
          Sends a methodname message to the receiver.
static boolean respondsToMethod(java.lang.Object obj, java.lang.String methodname)
          Returns true if the receiver implements or inherits a method that can respond to methodname messages, false otherwise.
static boolean respondsToMethod(java.lang.Object obj, java.lang.String methodname, java.lang.Class[] argTypes)
          Returns true if the receiver implements or inherits a method that can respond to method, false otherwise.
static boolean respondsToMethod(java.lang.Object obj, java.lang.String methodname, java.lang.Object[] args)
          Returns true if the receiver implements or inherits a method that can respond to method, false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isSubclass

public static final boolean isSubclass(java.lang.Class class_a,
                                       java.lang.Class class_b)
Return true if class a is either equivalent to class b, or if class a is a subclass of class b. Either or both "Class" objects may be interfaces.

Parameters:
class_a - a "Class" object which may be subclass of "Class" b.
class_b - a "Class" object which may be superclass of "Class" a.

isAssignable

public static final boolean isAssignable(java.lang.Class source,
                                         java.lang.Class target)
Return true if class source can be casted to class target.

Parameters:
source - a "Class" object which may be subclass of "Class" target.
target - a "Class" object which may be superclass of "Class" source.

isArray

public static final boolean isArray(java.lang.Object o)
Return true if object o is an array.

Parameters:
o - an object which may be an array.

isArray

public static final boolean isArray(java.lang.Class c)
Return true if class c is an array.

Parameters:
c - a "Class" object which may be an array.

is2DArray

public static final boolean is2DArray(java.lang.Class c)
Return true if class c is a 2-D array.

Parameters:
c - a "Class" object which may be a 2-D array.

getDimensionOfArray

public static final int getDimensionOfArray(java.lang.Class c)
Return the dimensino of array if class c is an array.

Parameters:
c - a "Class" object which may be an array.

makeObjectPerform

public static final java.lang.Object makeObjectPerform(java.lang.Object obj,
                                                       java.lang.String methodname,
                                                       java.lang.Object[] args,
                                                       java.lang.Class[] argTypes)
                                                throws java.lang.IllegalAccessException,
                                                       java.lang.IllegalArgumentException,
                                                       java.lang.reflect.InvocationTargetException,
                                                       java.lang.NoSuchMethodException
Sends the name of a method as a message to the receiver. This is equivalent to directly calling the receiver's method. For example, the following two lines do the same thing:
  Example:
		myObject.setTitle("MyName");
		ClassUtil.makeObjectPerform(myObject, "setTitle", {"MyName"});
 

Parameters:
obj - an object performing a method.
methodname - a method to be performed.
args - an array of arguments for the method.
Throws:
java.lang.IllegalAccessException - if the underlying methods is inaccessible.
java.lang.IllegalArgumentException - if the number of actual and formal parameters differ, or if an unwrapping conversion fails.
java.lang.reflect.InvocationTargetException - if the underlying methods throws an exception.
java.lang.NoSuchMethodException - if a matching methods is not found.

makeObjectPerform

public static final java.lang.Object makeObjectPerform(java.lang.Object obj,
                                                       java.lang.String methodname,
                                                       java.lang.Object[] args)
                                                throws java.lang.IllegalAccessException,
                                                       java.lang.IllegalArgumentException,
                                                       java.lang.reflect.InvocationTargetException,
                                                       java.lang.NoSuchMethodException
Sends the name of a method as a message to the receiver. This is equivalent to directly calling the receiver's method. For example, the following two lines do the same thing:
  Example:
		myObject.setTitle("MyName");
		ClassUtil.makeObjectPerform(myObject, "setTitle", {"MyName"});
 

Parameters:
obj - an object performing a method.
methodname - a method to be performed.
args - an array of arguments for the method.
Throws:
java.lang.IllegalAccessException - if the underlying methods is inaccessible.
java.lang.IllegalArgumentException - if the number of actual and formal parameters differ, or if an unwrapping conversion fails.
java.lang.reflect.InvocationTargetException - if the underlying methods throws an exception.
java.lang.NoSuchMethodException - if a matching methods is not found.

respondsToMethod

public static final boolean respondsToMethod(java.lang.Object obj,
                                             java.lang.String methodname,
                                             java.lang.Class[] argTypes)
Returns true if the receiver implements or inherits a method that can respond to method, false otherwise. The application is responsible for determining whether a false response should be considered an error.
  Example:
		if (ClassUtil.respondsToMethod(myObject, "setTitle", {"xxx"})) {
			myObject.setTitle("MyName");
		}
 

Parameters:
methodname - a method to be performed.
argTypes - an array of argument types for the methods.
Returns:
true if the receiver implements or inherits the methods, otherwiise false.
See Also:
#perform(String, Object[]), #perform(String), #respondsToMethod(String)

respondsToMethod

public static final boolean respondsToMethod(java.lang.Object obj,
                                             java.lang.String methodname,
                                             java.lang.Object[] args)
Returns true if the receiver implements or inherits a method that can respond to method, false otherwise. The application is responsible for determining whether a false response should be considered an error.
  Example:
		if (ClassUtil.respondsToMethod(myObject, "setTitle", {"xxx"})) {
			myObject.setTitle("MyName");
		}
 

Parameters:
methodname - a method to be performed.
args - an array of arguments for the methods.
Returns:
true if the receiver implements or inherits the methods, otherwiise false.
See Also:
#perform(String, Object[]), #perform(String), #respondsToMethod(String)

makeObjectPerform

public static final java.lang.Object makeObjectPerform(java.lang.Object obj,
                                                       java.lang.String methodname)
                                                throws java.lang.IllegalAccessException,
                                                       java.lang.IllegalArgumentException,
                                                       java.lang.reflect.InvocationTargetException,
                                                       java.lang.NoSuchMethodException
Sends a methodname message to the receiver. This is equivalent to sending a methodname message directly to the receiver. For example, the following two messages do the same thing:
  Example:
		myObject.show();
		myObject.perform("show");
 

Parameters:
obj - an object performing a method.
methodname - a method to be performed.
Throws:
java.lang.IllegalAccessException - if the underlying methods is inaccessible.
java.lang.IllegalArgumentException - if the number of actual and formal parameters differ, or if an unwrapping conversion fails.
java.lang.reflect.InvocationTargetException - if the underlying methods throws an exception.
java.lang.NoSuchMethodException - if a matching methods is not found.

respondsToMethod

public static final boolean respondsToMethod(java.lang.Object obj,
                                             java.lang.String methodname)
Returns true if the receiver implements or inherits a method that can respond to methodname messages, false otherwise. The application is responsible for determining whether a false response should be considered an error.
  Example:
		if(ClassUtil.respondsToMethod(myObject, "show"))
			myObject.show();
 

Parameters:
obj - an object performing a method.
methodname - a method to be performed.
Returns:
true if the receiver implements or inherits the methods, otherwiise false.

makeObjectPerformInThread

public static final java.lang.Thread makeObjectPerformInThread(java.lang.ThreadGroup group,
                                                               java.lang.Object object,
                                                               java.lang.reflect.Method method,
                                                               java.lang.Object[] args,
                                                               boolean forced)
                                                        throws java.lang.IllegalAccessException,
                                                               java.lang.IllegalArgumentException,
                                                               java.lang.reflect.InvocationTargetException,
                                                               java.lang.NoSuchMethodException
Sends a methodname message to the receiver. This is equivalent to sending a methodname message directly to the receiver. For example, the following two messages do the same thing:
  Example:
	myObject.setTitle("MyName");
  Object[] args = {String.class};
  Method method = myObject.getMethod("setTitle", args);
	ThreadGroup mygroup = new ThreadGroup(this.toString());
	myObject.performInThread(mygroup, method, {"MyName"}, false);
  Example of implementation:
	public synchronized void performInThread(ThreadGroup group, Method method, Object arg, boolean forced)  throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
	  ThreadTask task = new ThreadTask(this, method, args);
	  Thread newThread = new Thread(group,
						this,
						method.getName());
	  newThread.start();
	}
 

Parameters:
group - a thread group.
method - a method to be performed.
args - arguments for the method.
forced - a flag to force the specified method to be executed even if there is alread a thread executing the same method.
Throws:
java.lang.IllegalAccessException - if the underlying methods is inaccessible.
java.lang.IllegalArgumentException - if the number of actual and formal parameters differ, or if an unwrapping conversion fails.
java.lang.reflect.InvocationTargetException - if the underlying methods throws an exception.
java.lang.NoSuchMethodException - if a matching methods is not found.
See Also:
com.gpz.lang.MObject#perform(String), com.gpz.lang.MObject#respondsToMethod(String, Object[]), com.gpz.lang.MObject#respondsToMethod(String)

makeObjectPerformInThread

public static final java.lang.Thread makeObjectPerformInThread(java.lang.ThreadGroup group,
                                                               java.lang.Object object,
                                                               java.lang.reflect.Method method,
                                                               java.lang.Object[] args)
                                                        throws java.lang.IllegalAccessException,
                                                               java.lang.IllegalArgumentException,
                                                               java.lang.reflect.InvocationTargetException,
                                                               java.lang.NoSuchMethodException
Sends a methodname message to the receiver. This is equivalent to sending a methodname message directly to the receiver.

Parameters:
group - a thread group.
args - arguments for the method.
Throws:
java.lang.IllegalAccessException - if the underlying methods is inaccessible.
java.lang.IllegalArgumentException - if the number of actual and formal parameters differ, or if an unwrapping conversion fails.
java.lang.reflect.InvocationTargetException - if the underlying methods throws an exception.
java.lang.NoSuchMethodException - if a matching methods is not found.
See Also:
com.gpz.lang.MObject#perform(String), com.gpz.lang.MObject#respondsToMethod(String, Object[]), com.gpz.lang.MObject#respondsToMethod(String)

makeObjectPerformInThread

public static final java.lang.Thread makeObjectPerformInThread(java.lang.Object object,
                                                               java.lang.reflect.Method method,
                                                               java.lang.Object[] args)
                                                        throws java.lang.IllegalAccessException,
                                                               java.lang.IllegalArgumentException,
                                                               java.lang.reflect.InvocationTargetException,
                                                               java.lang.NoSuchMethodException
Sends a methodname message to the receiver. This is equivalent to sending a methodname message directly to the receiver.

Parameters:
args - arguments for the method.
Throws:
java.lang.IllegalAccessException - if the underlying methods is inaccessible.
java.lang.IllegalArgumentException - if the number of actual and formal parameters differ, or if an unwrapping conversion fails.
java.lang.reflect.InvocationTargetException - if the underlying methods throws an exception.
java.lang.NoSuchMethodException - if a matching methods is not found.
See Also:
com.gpz.lang.MObject#perform(String), com.gpz.lang.MObject#respondsToMethod(String, Object[]), com.gpz.lang.MObject#respondsToMethod(String)

makeObjectPerformInThread

public static final java.lang.Thread makeObjectPerformInThread(java.lang.Object object,
                                                               java.lang.reflect.Method method)
                                                        throws java.lang.IllegalAccessException,
                                                               java.lang.IllegalArgumentException,
                                                               java.lang.reflect.InvocationTargetException,
                                                               java.lang.NoSuchMethodException
Sends a methodname message to the receiver. This is equivalent to sending a methodname message directly to the receiver.

Throws:
java.lang.IllegalAccessException - if the underlying methods is inaccessible.
java.lang.IllegalArgumentException - if the number of actual and formal parameters differ, or if an unwrapping conversion fails.
java.lang.reflect.InvocationTargetException - if the underlying methods throws an exception.
java.lang.NoSuchMethodException - if a matching methods is not found.
See Also:
com.gpz.lang.MObject#perform(String), com.gpz.lang.MObject#respondsToMethod(String, Object[]), com.gpz.lang.MObject#respondsToMethod(String)

makeObjectPerformInThread

public static final java.lang.Thread makeObjectPerformInThread(java.lang.ThreadGroup group,
                                                               java.lang.Object object,
                                                               java.lang.String methodname,
                                                               java.lang.Object[] args,
                                                               boolean forced)
                                                        throws java.lang.IllegalAccessException,
                                                               java.lang.IllegalArgumentException,
                                                               java.lang.reflect.InvocationTargetException,
                                                               java.lang.NoSuchMethodException
Sends a methodname message to the receiver. This is equivalent to sending a methodname message directly to the receiver. For example, the following two messages do the same thing:
  Example:
		myObject.setTitle("MyName");
		ThreadGourp myThreadGroup = new ThreadGroup(this.toString());
		myObject.performInThread(myThreadGroup, "setTitle", {"MyName"}, false);
 

Parameters:
group - a thread group.
methodname - a method to be performed.
args - arguments for the method.
forced - a flag to force the specified method to be executed even if there is alread a thread executing the same method. (This function is not implemented in this release.)
Throws:
java.lang.IllegalAccessException - if the underlying methods is inaccessible.
java.lang.IllegalArgumentException - if the number of actual and formal parameters differ, or if an unwrapping conversion fails.
java.lang.reflect.InvocationTargetException - if the underlying methods throws an exception.
java.lang.NoSuchMethodException - if a matching methods is not found.
See Also:
com.gpz.lang.MObject#perform(String), com.gpz.lang.MObject#respondsToMethod(String, Object[]), com.gpz.lang.MObject#respondsToMethod(String)

makeObjectPerformInThread

public static final java.lang.Thread makeObjectPerformInThread(java.lang.ThreadGroup group,
                                                               java.lang.Object object,
                                                               java.lang.String methodname,
                                                               java.lang.Object[] args,
                                                               java.lang.Class[] argTypes,
                                                               boolean forced)
                                                        throws java.lang.IllegalAccessException,
                                                               java.lang.IllegalArgumentException,
                                                               java.lang.reflect.InvocationTargetException,
                                                               java.lang.NoSuchMethodException
Sends a methodname message to the receiver. This is equivalent to sending a methodname message directly to the receiver. For example, the following two messages do the same thing:
  Example:
		myObject.setTitle("MyName");
		ThreadGourp myThreadGroup = new ThreadGroup(this.toString());
		myObject.performInThread(myThreadGroup, "setTitle", {"MyName"}, false);
 

Parameters:
group - a thread group.
methodname - a method to be performed.
args - arguments for the method.
forced - a flag to force the specified method to be executed even if there is alread a thread executing the same method. (This function is not implemented in this release.)
Throws:
java.lang.IllegalAccessException - if the underlying methods is inaccessible.
java.lang.IllegalArgumentException - if the number of actual and formal parameters differ, or if an unwrapping conversion fails.
java.lang.reflect.InvocationTargetException - if the underlying methods throws an exception.
java.lang.NoSuchMethodException - if a matching methods is not found.
See Also:
com.gpz.lang.MObject#perform(String), com.gpz.lang.MObject#respondsToMethod(String, Object[]), com.gpz.lang.MObject#respondsToMethod(String)

makeObjectPerformInThread

public static final java.lang.Thread makeObjectPerformInThread(java.lang.ThreadGroup group,
                                                               java.lang.Object object,
                                                               java.lang.String methodname,
                                                               java.lang.Object[] args,
                                                               java.lang.Class[] argTypes)
                                                        throws java.lang.IllegalAccessException,
                                                               java.lang.IllegalArgumentException,
                                                               java.lang.reflect.InvocationTargetException,
                                                               java.lang.NoSuchMethodException
Sends a methodname message to the receiver. This is equivalent to sending a methodname message directly to the receiver. For example, the following two messages do the same thing:
  Example:
		myObject.setTitle("MyName");
		myObject.perform("setTitle", {"MyName"});
 

Parameters:
group - a thread group.
methodname - a method to be performed.
args - arguments for the method.
Throws:
java.lang.IllegalAccessException - if the underlying methods is inaccessible.
java.lang.IllegalArgumentException - if the number of actual and formal parameters differ, or if an unwrapping conversion fails.
java.lang.reflect.InvocationTargetException - if the underlying methods throws an exception.
java.lang.NoSuchMethodException - if a matching methods is not found.
See Also:
com.gpz.lang.MObject#perform(String), com.gpz.lang.MObject#respondsToMethod(String, Object[]), com.gpz.lang.MObject#respondsToMethod(String)

makeObjectPerformInThread

public static final java.lang.Thread makeObjectPerformInThread(java.lang.ThreadGroup group,
                                                               java.lang.Object object,
                                                               java.lang.String methodname,
                                                               java.lang.Object[] args)
                                                        throws java.lang.IllegalAccessException,
                                                               java.lang.IllegalArgumentException,
                                                               java.lang.reflect.InvocationTargetException,
                                                               java.lang.NoSuchMethodException
Sends a methodname message to the receiver. This is equivalent to sending a methodname message directly to the receiver. For example, the following two messages do the same thing:
  Example:
		myObject.setTitle("MyName");
		myObject.perform("setTitle", {"MyName"});
 

Parameters:
group - a thread group.
methodname - a method to be performed.
args - arguments for the method.
Throws:
java.lang.IllegalAccessException - if the underlying methods is inaccessible.
java.lang.IllegalArgumentException - if the number of actual and formal parameters differ, or if an unwrapping conversion fails.
java.lang.reflect.InvocationTargetException - if the underlying methods throws an exception.
java.lang.NoSuchMethodException - if a matching methods is not found.
See Also:
com.gpz.lang.MObject#perform(String), com.gpz.lang.MObject#respondsToMethod(String, Object[]), com.gpz.lang.MObject#respondsToMethod(String)

makeObjectPerformInThread

public static final java.lang.Thread makeObjectPerformInThread(java.lang.Object object,
                                                               java.lang.String methodname,
                                                               java.lang.Object[] args,
                                                               java.lang.Class[] argTypes)
                                                        throws java.lang.IllegalAccessException,
                                                               java.lang.IllegalArgumentException,
                                                               java.lang.reflect.InvocationTargetException,
                                                               java.lang.NoSuchMethodException
Sends a methodname message to the receiver. This is equivalent to sending a methodname message directly to the receiver. For example, the following two messages do the same thing:
  Example:
		myObject.setTitle("MyName");
		myObject.perform("setTitle", {"MyName"});
 

Parameters:
methodname - a method to be performed.
args - arguments for the method.
Throws:
java.lang.IllegalAccessException - if the underlying methods is inaccessible.
java.lang.IllegalArgumentException - if the number of actual and formal parameters differ, or if an unwrapping conversion fails.
java.lang.reflect.InvocationTargetException - if the underlying methods throws an exception.
java.lang.NoSuchMethodException - if a matching methods is not found.
See Also:
com.gpz.lang.MObject#perform(String), com.gpz.lang.MObject#respondsToMethod(String, Object[]), com.gpz.lang.MObject#respondsToMethod(String)

makeObjectPerformInThread

public static final java.lang.Thread makeObjectPerformInThread(java.lang.Object object,
                                                               java.lang.String methodname,
                                                               java.lang.Object[] args)
                                                        throws java.lang.IllegalAccessException,
                                                               java.lang.IllegalArgumentException,
                                                               java.lang.reflect.InvocationTargetException,
                                                               java.lang.NoSuchMethodException
Sends a methodname message to the receiver. This is equivalent to sending a methodname message directly to the receiver. For example, the following two messages do the same thing:
  Example:
		myObject.setTitle("MyName");
		myObject.perform("setTitle", {"MyName"});
 

Parameters:
methodname - a method to be performed.
args - arguments for the method.
Throws:
java.lang.IllegalAccessException - if the underlying methods is inaccessible.
java.lang.IllegalArgumentException - if the number of actual and formal parameters differ, or if an unwrapping conversion fails.
java.lang.reflect.InvocationTargetException - if the underlying methods throws an exception.
java.lang.NoSuchMethodException - if a matching methods is not found.
See Also:
com.gpz.lang.MObject#perform(String), com.gpz.lang.MObject#respondsToMethod(String, Object[]), com.gpz.lang.MObject#respondsToMethod(String)

makeObjectPerformInThread

public static final java.lang.Thread makeObjectPerformInThread(java.lang.Object object,
                                                               java.lang.String methodname)
                                                        throws java.lang.IllegalAccessException,
                                                               java.lang.IllegalArgumentException,
                                                               java.lang.reflect.InvocationTargetException,
                                                               java.lang.NoSuchMethodException
Sends a methodname message to the receiver. This is equivalent to sending a methodname message directly to the receiver. For example, the following two messages do the same thing:
  Example:
		myObject.show();
		myObject.perform("show");
 

Parameters:
methodname - a method to be performed.
Throws:
java.lang.IllegalAccessException - if the underlying methods is inaccessible.
java.lang.IllegalArgumentException - if the number of actual and formal parameters differ, or if an unwrapping conversion fails.
java.lang.reflect.InvocationTargetException - if the underlying methods throws an exception.
java.lang.NoSuchMethodException - if a matching methods is not found.
See Also:
com.gpz.lang.MObject#perform(String), com.gpz.lang.MObject#respondsToMethod(String, Object[]), com.gpz.lang.MObject#respondsToMethod(String)

getWrapperClass

public static final java.lang.Class getWrapperClass(java.lang.Class primitiveClass)
Returns a corresponding wrapper class of the specified primitive class.

Parameters:
primitiveClass - a class represnts a primitive (one of Boolean.TYPE, Character.TYPE, Byte.TYPE, Short.TYPE, Integer.TYPE, Long.TYPE, Float.TYPE, Double.TYPE).

getWrapperClasses

public static final java.lang.Class[] getWrapperClasses(java.lang.Class[] primitiveClasses)
Converts Class objects representing primitive classes into corresponding wrapper classs. The original array will be over written by new classes.

Parameters:
primitiveClasses - an array containing classs.

getPrimitiveClass

public static final java.lang.Class getPrimitiveClass(java.lang.String primitive)
Returns a corresponding class of the specified primitive class.

Parameters:
primitive - a string represnts a primitive (one of "boolean", "char", "byte", "short", "int", "long", "float", "double").

getClassNames

public static final java.lang.String[] getClassNames(java.lang.Class[] classes)

getClasses

public static final java.lang.Class[] getClasses(java.lang.String[] names)

getClass

public static final java.lang.Class getClass(java.lang.String name)

getRootName

public static final java.lang.String getRootName(java.lang.Class clazz)
Returns the name of the root class from a full class path.

Returns:
The root name of the class i.e., ActionListener

getRootName

public static final java.lang.String getRootName(java.lang.String fullName)
Returns the name of the root class from a full class path.

Parameters:
fullName - The full name of the class i.e, java.awt.event.ActionListener
Returns:
The root name of the class i.e., ActionListener

getCompilableName

public static final java.lang.String getCompilableName(java.lang.Class clazz)
Returns the class name, which can be inserted in java source code, from a fully-qualified class name.

Returns:
The class name that can be inserted in java source code i.e., java.awt.event.ActionListener, java.lang.String[][]

getCompilableNames

public static final java.lang.String[] getCompilableNames(java.lang.Class[] classes)
Returns the class name, which can be inserted in java source code, from a fully-qualified class name.

Returns:
The class name that can be inserted in java source code i.e., java.awt.event.ActionListener, java.lang.String[][]

getCompilableName

public static final java.lang.String getCompilableName(java.lang.String fullName)
Returns the class name, which can be inserted in java source code, from a fully-qualified class name.

Parameters:
fullName - The full name of the class i.e, java.awt.event.ActionListener, [[Ljava.lang.String
Returns:
The class name that can be inserted in java source code i.e., java.awt.event.ActionListener, java.lang.String[][]

formatMethodSignature

public static final java.lang.String formatMethodSignature(java.lang.reflect.Method method)
Returns a string that formats the method signature for desplay

Parameters:
method - The method to format.

formatMethodSignatureWithoutReturnType

public static final java.lang.String formatMethodSignatureWithoutReturnType(java.lang.reflect.Method method)
Returns a string that formats the method signature for desplay

Parameters:
method - The method to format.

formatParameters

public static final java.lang.String formatParameters(java.lang.reflect.Method method)
Returns a string that formats the parameters for a methods for display

Parameters:
method - The method to format.

formatReturnType

public static final java.lang.String formatReturnType(java.lang.reflect.Method method)
Returns a string that formats the parameters for a methods for display

Parameters:
method - The method to format.

decapitalize

public static final java.lang.String decapitalize(java.lang.String name)
Utility method to take a string and convert it to normal Java variable name capitalization. This normally means converting the first character from upper case to lower case, but in the (unusual) special case when there is more than two character and the first, second and third characters are upper case, we leave it alone.

Thus "FooBah" becomes "fooBah" and "X" becomes "x", but "URL" stays as "URL".

Parameters:
name - The string to be decapitalized.
Returns:
The decapitalized version of the string.

forceDecapitalize

public static final java.lang.String forceDecapitalize(java.lang.String name)
Utility method to take a string and convert it to normal Java variable name capitalization. This normally means converting the first character from upper case to lower case.

Thus "FooBah" becomes "fooBah" and "X" becomes "x", and "URL" becomes as "uRL".

Parameters:
name - The string to be decapitalized.
Returns:
The decapitalized version of the string.

capitalize

public static final java.lang.String capitalize(java.lang.String name)
Utility method to take a string and convert it to normal Java Class name capitalization. This normally means converting the first character from lower case to upper case.

Parameters:
name - The string to be capitalized.
Returns:
The capitalized version of the string.

getRootDirectoryName

public static final java.lang.String getRootDirectoryName(java.lang.String fullPath,
                                                          java.lang.String classFileName)
Returns the name of the root directory where the specified class resides.

Returns:
The root name of the class i.e., ActionListener

getMethod

public static final java.lang.reflect.Method getMethod(java.lang.Object obj,
                                                       java.lang.String methodName,
                                                       java.lang.Class[] argTypes)


Copyright © 2003 JBean project. All Rights Reserved.