org.naturalcli
Class NaturalCLI

java.lang.Object
  extended by org.naturalcli.NaturalCLI

public class NaturalCLI
extends java.lang.Object

A set of commands understood by the CLI

Author:
Ferran Busquets

Constructor Summary
NaturalCLI(java.util.Set<Command> commands)
          Creates a new instance with the default parameter validator.
NaturalCLI(java.util.Set<Command> commands, ParameterValidator pv)
          Creates a new instance.
 
Method Summary
 void execute(java.lang.String args)
          Runs a command based on the arguments in the string.
 void execute(java.lang.String[] args)
          Runs a command based on the arguments.
 void execute(java.lang.String[] args, int first)
          Runs a command based on the arguments.
 void execute(java.lang.String args, int first)
          Runs a command based on the arguments.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NaturalCLI

public NaturalCLI(java.util.Set<Command> commands,
                  ParameterValidator pv)
Creates a new instance.

Parameters:
commands - the set of commands that can be executed.
pv - the parameter validator.

NaturalCLI

public NaturalCLI(java.util.Set<Command> commands)
Creates a new instance with the default parameter validator.

Parameters:
commands - the set of commands that can be executed.
Method Detail

execute

public void execute(java.lang.String[] args,
                    int first)
             throws ExecutionException
Runs a command based on the arguments.

Parameters:
args - the arguments to be parsed
first - the index on args of the first string for the arguments.
Throws:
ExecutionException

execute

public void execute(java.lang.String args,
                    int first)
             throws ExecutionException
Runs a command based on the arguments.

Parameters:
args - the string arguments to run.
first - the index on args of the first string for the arguments.
Throws:
ExecutionException
UnknownParameterType

execute

public void execute(java.lang.String[] args)
             throws ExecutionException
Runs a command based on the arguments.

Parameters:
args - the arguments to be parsed
Throws:
ExecutionException

execute

public void execute(java.lang.String args)
             throws ExecutionException
Runs a command based on the arguments in the string.

Parameters:
args - the string with the arguments to be parsed
Throws:
ExecutionException