/* JFox, the OpenSource J2EE Application Server
 *
 * Distributable under GNU LGPL license by gun.org
 * more details please visit http://www.huihoo.org/jfox
 */
package org.jfox.framework;

/**
 * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
 */

public abstract class ComponentFactorySupport implements ComponentFactory {

    protected Object[] parseParameters(Parameter[] params) throws ComponentException {
        if(params == null || params.length == 0) {
            return new Object[]{};
        }
        else {
            Object[] objs = new Object[params.length];
            for(int i = 0; i < params.length; i++) {
                objs[i] = params[i].resolveValue(getRegistry());
            }
            return objs;
        }
    }

    protected Class[] parseParamTypes(Parameter[] params) {
        if(params == null) {
            return new Class[]{};
        }
        else {
            Class[] types = new Class[params.length];
            for(int i = 0; i < params.length; i++) {
                types[i] = params[i].getType();
            }
            return types;
        }
    }

    public static void main(String[] args) {

    }
}

