boolean DEBUG = Debug.debugging("componentfactory");
boolean DEBUG = Debug.debugging("componentfactorydetail");
    protected static Object createWithSubclassConstructorArgs(Class newObjClass, 							      Class[] argClasses) 	throws NoSuchMethodException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {	boolean DEBUG = Debug.debugging("componentfactory");	int numArgClasses = 0;	if (argClasses != null) {	    numArgClasses = argClasses.length;	}	Constructor[] constructors = newObjClass.getConstructors();	int numConstructors = constructors.length;	for (int i = 0; i < numConstructors; i++) {	    Constructor constructor = constructors[i];	    Class[] arguments = constructor.getParameterTypes();	    int numArgs = arguments.length;	    // First, check the number of arguments for a match	    if (numArgs != numArgClasses) {		if (DEBUG) {		    Debug.output(" - constructor " + i + " with " + numArgs +				 " arguments not a match");		}		continue;  // Nope, not it.	    }	    // OK, empty constructor desired, punch...	    if (numArgs == 0) {		if (DEBUG) {		    Debug.output(" - constructor " + i + 				 " with no arguments is a match");		}		return constructor;	    }	    // Check to see if the argument classes of the Constructor are 	    // assignable to the desired argClasses being sought.	    boolean good = false;	    for (int j = 0; j < numArgs; j++) {		if (arguments[j] == argClasses[j]) {		    if (DEBUG) {			Debug.output(" - direct arg class match, arg " + j);		    }		    good = true; // Maintain true...		} else if (arguments[j].isAssignableFrom(argClasses[j])) {		    // Doesn't work quite yet.  May have to check for		    //  super-super class,etc, and we still get an		    //  IllegalArgumentException due to argument type		    //  mismatch.		    argClasses[j] = argClasses[j].getSuperclass();		    if (DEBUG) {			Debug.output(" - superclass arg class match, arg " + j + 				     " reassigning to " + argClasses[j].toString());		    }		    good = true; // Maintain true...		} else {		    if (DEBUG) {			Debug.output(" - arg class mismatch on arg " + j + ", bailing");		    }		    good = false; // Punch with false		    break;		}	    }	    if (good) {		if (DEBUG) {		    Debug.debugging(" - creating object");		}		Object obj = constructor.newInstance(argClasses);		if (DEBUG) {		    Debug.debugging(" - created object");		}		return obj;	    }	}	return null;    }