/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.essar.automation.dhaval.invoker.store;

import java.lang.reflect.Method;

/**
 *
 * @author dhaval
 */
public class Invoker {

    private Class clazz;
    private String methodName;
    private Class[] methodParamTypes;
    private Object[] methodArgs;
    private Object target;

    public Class getClazz() {
        return clazz;
    }

    public void setClazz(Class clazz) {
        this.clazz = clazz;
    }

    public Object[] getMethodArgs() {
        return methodArgs;
    }

    public void setMethodArgs(Object[] methodArgs) {
        this.methodArgs = methodArgs;
    }

    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    public Class[] getMethodParamTypes() {
        return methodParamTypes;
    }

    public void setMethodParamTypes(Class[] methodParamTypes) {
        this.methodParamTypes = methodParamTypes;
    }

    public Object getTarget() {
        return target;
    }

    public void setTarget(Object target) {
        this.target = target;
    }


    public Object invoke() throws Exception {
        Method method = clazz.getMethod(methodName, methodParamTypes);
        return method.invoke(target, methodArgs);
    }
}
