package com.acme.vcutil.helper;


import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import javax.faces.context.FacesContext;


public class UIComponentHelper
{

    public void checkComponents()
    {
    }

    private void arrangeComponentsAccToComponentDefinitions() throws ClassNotFoundException, IllegalAccessException, InvocationTargetException
    {
        //initialize parameters
        Class classes[] = new Class[1];
        Object params[] = new Object[1];
        classes[0] = boolean.class;

        FacesContext fctx = FacesContext.getCurrentInstance();
        fctx.renderResponse();
    }

    private void setValueByReflection(Object object, Class invokedClass, Object[] parameters, Class[] parameterClasses, String symbol) throws IllegalAccessException,
                                                                                                                                              InvocationTargetException
    {
        Object myParameters[] = parameters;
        Class myParameterClasses[] = parameterClasses;
        Method myMethod = null;
        try
        {
            myMethod = invokedClass.getMethod("set" + symbol.toString(), myParameterClasses);
            if (myMethod != null)
                myMethod.invoke(object, myParameters);
        }
        catch (SecurityException e)
        {
            e.printStackTrace();
        }
        catch (NoSuchMethodException e)
        {
            e.printStackTrace();
        }
    }
}
