Class SingleMethodCallCommand

  • All Implemented Interfaces:
    RemoteCommand

    public class SingleMethodCallCommand
    extends Object
    implements RemoteCommand
    This command will allow you to call one specific method with the arguments given by the execute method on a component.
    Version:
    $Id$
    Author:
    Nicolas Filotto
    • Constructor Detail

      • SingleMethodCallCommand

        public SingleMethodCallCommand​(Object component,
                                       String methodName,
                                       Class<?>... parameterTypes)
                                throws SecurityException,
                                       NoSuchMethodException,
                                       ClassNotFoundException
        Parameters:
        component - the component on which we want to execute the method
        methodName - the name of the method
        parameterTypes - the parameter array
        Throws:
        NoSuchMethodException - if a matching method is not found.
        SecurityException - If a security manager, s, is present and any of the following conditions is met:
        • invocation of s.checkMemberAccess(this, Member.DECLARED) denies access to the declared method
        • the caller's class loader is not the same as or an ancestor of the class loader for the current class and invocation of s.checkPackageAccess() denies access to the package of this class
        ClassNotFoundException - If the last parameter type is an array and we cannot find the type of the array
    • Method Detail

      • execute

        public Serializable execute​(Serializable[] args)
                             throws Throwable
        This method will execute the command on the local machine.
        Specified by:
        execute in interface RemoteCommand
        Parameters:
        args - The parameters needed to execute the command
        Returns:
        arbitrary return value generated by performing this command
        Throws:
        Throwable - in the event of problems.
      • getId

        public String getId()
        Gives the id of the command
        Specified by:
        getId in interface RemoteCommand
        Returns:
        the unique ID of the command