001 package org.shiftone.jrat.core.proxy; 002 003 004 import org.shiftone.jrat.api.Command; 005 006 import java.lang.reflect.Method; 007 008 009 /** 010 * @author jeff@shiftone.org (Jeff Drost) 011 */ 012 public class ProxyCommand implements Command { 013 014 private final Object target; 015 private final Method method; 016 private final Object[] args; 017 018 public ProxyCommand(Object target, Method method, Object[] args) { 019 020 this.target = target; 021 this.method = method; 022 this.args = args; 023 } 024 025 026 public Object execute() throws Throwable { 027 return method.invoke(target, args); 028 } 029 }