FileDocCategorySizeDatePackage
ObjectFactory.javaAPI DocGlassfish v2 API3734Fri May 04 22:35:00 BST 2007com.sun.enterprise.tools.common.validation.util

ObjectFactory

public class ObjectFactory extends Object
This class is a generic Factory that employes Java reflection to create Objects.
author
Rajeshwar Patil
version
%I%, %G%

Fields Summary
Constructors Summary
Methods Summary
public static java.lang.ObjectnewInstance(java.lang.String className)
Create an instance of the class with the specified name by calling the no-argument constructor.

        
        Utils utils = new Utils();
        return utils.createObject(className);
    
public static java.lang.ObjectnewInstance(java.lang.String className, java.lang.String argument)
Create an instance of the class with the specified name by calling the a constructor that takes an String.

        Class classObject = null;
        Utils utils = new Utils();

        Class[] argumentTypes = new Class[] {String.class};
        Constructor constructor =
            utils.getConstructor(className, argumentTypes);

        Object[] argumentValues = new Object[] {argument};

        return utils.createObject(constructor, argumentValues);
    
public static java.lang.ObjectnewInstance(java.lang.String className, java.lang.Object argument)
Create an instance of the class with the specified name by calling the a constructor that takes an String.

        Class classObject = null;
        Utils utils = new Utils();

        Class[] argumentTypes = new Class[] {Object.class};
        Constructor constructor =
            utils.getConstructor(className, argumentTypes);

        Object[] argumentValues = new Object[] {argument};

        return utils.createObject(constructor, argumentValues);