com.metamatrix.core.commandshell
Class Command

java.lang.Object
  extended by com.metamatrix.core.commandshell.Command

public class Command
extends java.lang.Object

Executes a command string on a given object. The command string is expected to be of the form: ... Where the method name is the name of a method on the target object and where the argument count matches the signature of the method on the target object and where the argument strings can be converted to the types of the arguments in the target method.


Constructor Summary
Command(java.lang.Object target, java.lang.String commandLine)
          Instantiate a command for a target object.
Command(java.lang.Object target, java.lang.String[] commandLine)
          Instantiate a command for a target object.
Command(java.lang.Object target, java.lang.String commandName, java.lang.String[] args)
          Insantiate a command for a target object.
 
Method Summary
 java.lang.Object execute()
           
 java.lang.Object execute(java.util.Set methodsToIgnore)
          Execute the command on the target object.
 void setDefaultFilePath(java.lang.String defaultFilePath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Command

public Command(java.lang.Object target,
               java.lang.String[] commandLine)
Instantiate a command for a target object.

Parameters:
target - The object to execute the command on.
commandLine - The substrings making up a single command.

Command

public Command(java.lang.Object target,
               java.lang.String commandLine)
Instantiate a command for a target object.

Parameters:
target - The object to execute the command on.
commandLine - The command to execute.

Command

public Command(java.lang.Object target,
               java.lang.String commandName,
               java.lang.String[] args)
Insantiate a command for a target object.

Parameters:
target - The object to execute the command on.
commandName - The name of the method to execute.
args - The arguments for the method to execute.
Method Detail

setDefaultFilePath

public void setDefaultFilePath(java.lang.String defaultFilePath)

execute

public java.lang.Object execute()
                         throws java.lang.NoSuchMethodException,
                                WrongNumberOfArgumentsException,
                                ArgumentConversionException
Throws:
java.lang.NoSuchMethodException
WrongNumberOfArgumentsException
ArgumentConversionException

execute

public java.lang.Object execute(java.util.Set methodsToIgnore)
                         throws java.lang.NoSuchMethodException,
                                WrongNumberOfArgumentsException,
                                ArgumentConversionException
Execute the command on the target object.

Parameters:
methodsToIgnore - contains the names of methods to exclude from the methods searched for matches.
Returns:
The results of reflectively invoking the command on the target object.
Throws:
java.lang.NoSuchMethodException
WrongNumberOfArgumentsException
ArgumentConversionException


Copyright © 2009. All Rights Reserved.