MATES 3.0-rc2

org.mates.util
Class ClassCreator

java.lang.Object
  extended byorg.mates.util.ClassCreator

public class ClassCreator
extends java.lang.Object

Wrapper for Java's Reflection API.

Author:
Evan Sultanik

Constructor Summary
ClassCreator()
           
 
Method Summary
static java.lang.Object getClass(java.lang.String class_name)
          Returns a new instance of a class from the class' name.
static java.lang.Object getClass(java.lang.String class_name, java.lang.Class[] parameters, java.lang.Object[] arguments)
          Returns a new instance of a class from the class' name and the arguments for its constructor.
static java.lang.Object invokeMethod(java.lang.Object object, java.lang.String method_name)
          Invokes a method of a class that does not take any arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassCreator

public ClassCreator()
Method Detail

getClass

public static java.lang.Object getClass(java.lang.String class_name)
                                 throws java.lang.InstantiationException,
                                        java.lang.IllegalAccessException,
                                        java.lang.IllegalArgumentException,
                                        java.lang.reflect.InvocationTargetException,
                                        java.lang.NoSuchMethodException,
                                        java.lang.ClassNotFoundException
Returns a new instance of a class from the class' name.

Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
java.lang.ClassNotFoundException

getClass

public static java.lang.Object getClass(java.lang.String class_name,
                                        java.lang.Class[] parameters,
                                        java.lang.Object[] arguments)
                                 throws java.lang.InstantiationException,
                                        java.lang.IllegalAccessException,
                                        java.lang.IllegalArgumentException,
                                        java.lang.reflect.InvocationTargetException,
                                        java.lang.NoSuchMethodException,
                                        java.lang.ClassNotFoundException
Returns a new instance of a class from the class' name and the arguments for its constructor.

Parameters:
class_name - the name of the class to be instantiated
parameters - an array of the class types of the arguments. If this is null, the default constructor will be called.
arguments - an array of arguments to pass to the constructor
Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
java.lang.ClassNotFoundException

invokeMethod

public static java.lang.Object invokeMethod(java.lang.Object object,
                                            java.lang.String method_name)
                                     throws java.lang.NoSuchMethodException,
                                            java.lang.SecurityException,
                                            java.lang.IllegalAccessException,
                                            java.lang.IllegalArgumentException,
                                            java.lang.reflect.InvocationTargetException
Invokes a method of a class that does not take any arguments.

Parameters:
object - the object from which to call the method
method_name - the name of the method in object to call.
Throws:
java.lang.NoSuchMethodException
java.lang.SecurityException
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetException

MATES 3.0-rc2

Submit a bug or request a feature
http://mates.sourceforge.net/

Copyright 2004 Evan Sultanik