1 23 24 27 28 package com.sun.enterprise.tools.common.validation.util; 29 30 import java.lang.reflect.Constructor ; 31 32 38 39 public class ObjectFactory { 40 41 42 45 public static Object newInstance(String className){ 46 47 Utils utils = new Utils(); 48 return utils.createObject(className); 49 } 50 51 52 55 public static Object newInstance(String className, String argument){ 56 Class classObject = null; 57 Utils utils = new Utils(); 58 59 Class [] argumentTypes = new Class [] {String .class}; 60 Constructor constructor = 61 utils.getConstructor(className, argumentTypes); 62 63 Object [] argumentValues = new Object [] {argument}; 64 65 return utils.createObject(constructor, argumentValues); 66 } 67 68 69 72 public static Object newInstance(String className, Object argument){ 73 Class classObject = null; 74 Utils utils = new Utils(); 75 76 Class [] argumentTypes = new Class [] {Object .class}; 77 Constructor constructor = 78 utils.getConstructor(className, argumentTypes); 79 80 Object [] argumentValues = new Object [] {argument}; 81 82 return utils.createObject(constructor, argumentValues); 83 } 84 } 85 | Popular Tags |