Class AbstractCommandHandler
java.lang.Object
com.pnfsoftware.jeb.util.interpreter.AbstractCommandHandler
- All Implemented Interfaces:
ICommandHandler
,ICommandNode
Skeleton for a command handler.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
protected String
protected String
protected List<CommandParameter>
protected ICommandManager
Fields inherited from interface com.pnfsoftware.jeb.util.interpreter.ICommandNode
QUOTES_AS_NORMAL_CHAR
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractCommandHandler
(ICommandManager parent, String name) AbstractCommandHandler
(ICommandManager parent, String name, CommandParameter[] params, String help, String helpDetails) AbstractCommandHandler
(ICommandManager parent, String name, String help) AbstractCommandHandler
(ICommandManager parent, String name, String[] paramNames, String help, String helpDetails) -
Method Summary
Modifier and TypeMethodDescriptionaddParameter
(CommandParameter parameter) addParameter
(String paramName) getHelp()
Retrieve a short help that describes the commandGive additional details (used when "help $command" is called).getName()
Retrieve the name of the command (used to invoke the command)int
static String
getParameter
(List<InputToken> tokens, int i) Get a parameter.int
getParameterIndex
(String paramName, String prefix) Retrieve the list of parameters available for this commandstatic String
getParameterSafe
(List<InputToken> tokens, int i) Get a parameter, never return null.Retrieve the parent, that is, this node's manager.static InputToken
getToken
(List<InputToken> tokens, int i) parseInputToken
(List<InputToken> tokens) parseInputToken
(List<InputToken> tokens, boolean failOnErrors) Assign the inputToken value in the same index as innerCommandParameter
list.protected void
protected void
setOptions
(int options) toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.pnfsoftware.jeb.util.interpreter.ICommandNode
execute
-
Field Details
-
parent
-
name
-
params
-
help
-
helpDetails
-
-
Constructor Details
-
AbstractCommandHandler
-
AbstractCommandHandler
-
AbstractCommandHandler
public AbstractCommandHandler(ICommandManager parent, String name, String[] paramNames, String help, String helpDetails) -
AbstractCommandHandler
public AbstractCommandHandler(ICommandManager parent, String name, CommandParameter[] params, String help, String helpDetails)
-
-
Method Details
-
parseInputToken
-
parseInputToken
Assign the inputToken value in the same index as innerCommandParameter
list. Note that the result array can have a bigger size than innerCommandParameter
list if the lastCommandParameter
item allow Multiple parameters.- Parameters:
failOnErrors
- set to false if you allow missing parameter after a prefixed parameter (used for autocompletion) or missing mandatory parameters
-
getParent
Description copied from interface:ICommandNode
Retrieve the parent, that is, this node's manager.- Specified by:
getParent
in interfaceICommandNode
- Returns:
-
getChildren
- Specified by:
getChildren
in interfaceICommandNode
- Returns:
-
getName
Description copied from interface:ICommandNode
Retrieve the name of the command (used to invoke the command)- Specified by:
getName
in interfaceICommandNode
- Returns:
-
setName
-
getHelp
Description copied from interface:ICommandNode
Retrieve a short help that describes the command- Specified by:
getHelp
in interfaceICommandNode
- Returns:
-
setHelp
-
getHelpDetails
Description copied from interface:ICommandHandler
Give additional details (used when "help $command" is called). Please provide the most details to help user: any trick, return format.- Specified by:
getHelpDetails
in interfaceICommandHandler
-
getParameters
Description copied from interface:ICommandHandler
Retrieve the list of parameters available for this command- Specified by:
getParameters
in interfaceICommandHandler
-
getParameterIndex
-
addParameter
-
addParameter
-
toString
-
getToken
-
getParameter
Get a parameter.- Parameters:
tokens
-i
-- Returns:
- the parameter, null on error
-
getParameterSafe
Get a parameter, never return null.- Parameters:
tokens
-i
-- Returns:
- the parameter, or the empty string on error
-
getOptions
public int getOptions()- Specified by:
getOptions
in interfaceICommandNode
- Returns:
-
setOptions
-