|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.notuvy.cmd.CommandAction com.notuvy.cmd.CommandSet
public class CommandSet
A command line argument interpreter. User: murali Date: Jan 2, 2008 Time: 2:04:45 PM
Field Summary | |
---|---|
static String |
CMD_HELP
|
static String |
CMD_VERSION
|
Fields inherited from class com.notuvy.cmd.CommandAction |
---|
LOG |
Constructor Summary | |
---|---|
|
CommandSet()
|
protected |
CommandSet(String pKey)
|
Method Summary | |
---|---|
CommandSet |
define(CommandAction pAction)
Add the given command to this set. |
CommandSet |
defineSynonym(String pSynonym,
String pKey)
Define a command as a synonym for an existing command. |
void |
defineVersionFrom(Class pReferenceClass)
|
void |
defineVersionFrom(Class pReferenceClass,
String pAdditional)
|
static void |
execute(Commandable pCommandable,
String[] pArgs)
The top-level entry point to application execution. |
static void |
execute(DefaultedCommandable pCommandable,
String[] pArgs)
|
static void |
execute(SimpleExecutable pExecutable,
String[] pArgs)
|
List<String> |
getHandled()
Give the list of all commands that were handled. |
protected Map<String,CommandAction> |
getMap()
|
protected boolean |
handle(CommandArgs pArgs)
|
boolean |
isAllowEmpty()
Whether it is acceptable for the command set to be executed with no arguments. |
List<String> |
listCommands()
|
protected List<String> |
preliminaryCommands()
|
void |
processAndExecute(String[] pArgs,
Runnable pRunnable)
The primary action is defined externally by the given Runnable, so process all the given arguments, then execute the runnable (assuming no errors during processing). |
protected boolean |
processNext(CommandArgs pArgs)
|
void |
setAllowEmpty(boolean pAllowEmpty)
Define whether it is acceptable for the command set to be executed with no arguments. |
String |
toString()
|
String |
toUsageString()
|
Methods inherited from class com.notuvy.cmd.CommandAction |
---|
constructParentCommands, getKey, getParent, isTerminated, process, process, setParent, setTerminated |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String CMD_HELP
public static final String CMD_VERSION
Constructor Detail |
---|
public CommandSet()
protected CommandSet(String pKey)
Method Detail |
---|
public static void execute(Commandable pCommandable, String[] pArgs)
pCommandable
- The initialized application instance.pArgs
- The raw command line args.public static void execute(DefaultedCommandable pCommandable, String[] pArgs)
public static void execute(SimpleExecutable pExecutable, String[] pArgs)
protected Map<String,CommandAction> getMap()
public List<String> getHandled()
public boolean isAllowEmpty()
public void setAllowEmpty(boolean pAllowEmpty)
pAllowEmpty
- boolean flag.protected boolean processNext(CommandArgs pArgs)
public void defineVersionFrom(Class pReferenceClass)
public void defineVersionFrom(Class pReferenceClass, String pAdditional)
public CommandSet define(CommandAction pAction)
pAction
- action object
public CommandSet defineSynonym(String pSynonym, String pKey)
pSynonym
- The new command to define.pKey
- The name of the existing command to duplicate.
public void processAndExecute(String[] pArgs, Runnable pRunnable)
pArgs
- The list of arguments (from the main method).pRunnable
- The externally define principle action.public String toString()
toString
in class Object
protected boolean handle(CommandArgs pArgs)
handle
in class CommandAction
public List<String> listCommands()
listCommands
in class CommandAction
protected List<String> preliminaryCommands()
public String toUsageString()
toUsageString
in class CommandAction
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |