public abstract class

AbstractCommandHandler

extends Object
implements ICommandHandler
java.lang.Object
   ↳ com.pnfsoftware.jeb.util.interpreter.AbstractCommandHandler

Class Overview

Skeleton for a command handler.

Summary

[Expand]
Inherited Constants
From interface com.pnfsoftware.jeb.util.interpreter.ICommandNode
Fields
protected String help
protected String helpDetails
protected String name
protected List<CommandParameter> params
protected ICommandManager parent
Public Constructors
AbstractCommandHandler(ICommandManager parent, String name)
AbstractCommandHandler(ICommandManager parent, String name, String help)
AbstractCommandHandler(ICommandManager parent, String name, String[] paramNames, String help, String helpDetails)
AbstractCommandHandler(ICommandManager parent, String name, CommandParameter[] params, String help, String helpDetails)
Public Methods
AbstractCommandHandler addParameter(String paramName)
AbstractCommandHandler addParameter(CommandParameter parameter)
List<ICommandNode> getChildren()
String getHelp()
Retrieve a short help that describes the command
String getHelpDetails()
Give additional details (used when "help $command" is called).
String getName()
Retrieve the name of the command (used to invoke the command)
int getOptions()
static String getParameter(List<InputToken> tokens, int i)
Get a parameter.
int getParameterIndex(String paramName, String prefix)
static String getParameterSafe(List<InputToken> tokens, int i)
Get a parameter, never return null.
List<CommandParameter> getParameters()
Retrieve the list of parameters available for this command
ICommandManager getParent()
Retrieve the parent, that is, this node's manager.
static InputToken getToken(List<InputToken> tokens, int i)
InputToken[] parseInputToken(List<InputToken> tokens, boolean failOnErrors)
Assign the inputToken value in the same index as inner CommandParameter list.
InputToken[] parseInputToken(List<InputToken> tokens)
AbstractCommandHandler setOptions(int options)
String toString()
Protected Methods
void setHelp(String help)
void setName(String name)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pnfsoftware.jeb.util.interpreter.ICommandHandler
From interface com.pnfsoftware.jeb.util.interpreter.ICommandNode

Fields

protected String help

protected String helpDetails

protected String name

protected List<CommandParameter> params

protected ICommandManager parent

Public Constructors

public AbstractCommandHandler (ICommandManager parent, String name)

public AbstractCommandHandler (ICommandManager parent, String name, String help)

public AbstractCommandHandler (ICommandManager parent, String name, String[] paramNames, String help, String helpDetails)

public AbstractCommandHandler (ICommandManager parent, String name, CommandParameter[] params, String help, String helpDetails)

Public Methods

public AbstractCommandHandler addParameter (String paramName)

public AbstractCommandHandler addParameter (CommandParameter parameter)

public List<ICommandNode> getChildren ()

public String getHelp ()

Retrieve a short help that describes the command

public String getHelpDetails ()

Give additional details (used when "help $command" is called). Please provide the most details to help user: any trick, return format.

public String getName ()

Retrieve the name of the command (used to invoke the command)

public int getOptions ()

public static String getParameter (List<InputToken> tokens, int i)

Get a parameter.

Returns
  • the parameter, null on error

public int getParameterIndex (String paramName, String prefix)

public static String getParameterSafe (List<InputToken> tokens, int i)

Get a parameter, never return null.

Returns
  • the parameter, or the empty string on error

public List<CommandParameter> getParameters ()

Retrieve the list of parameters available for this command

public ICommandManager getParent ()

Retrieve the parent, that is, this node's manager.

public static InputToken getToken (List<InputToken> tokens, int i)

public InputToken[] parseInputToken (List<InputToken> tokens, boolean failOnErrors)

Assign the inputToken value in the same index as inner CommandParameter list. Note that the result array can have a bigger size than inner CommandParameter list if the last CommandParameter 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

public InputToken[] parseInputToken (List<InputToken> tokens)

public AbstractCommandHandler setOptions (int options)

public String toString ()

Protected Methods

protected void setHelp (String help)

protected void setName (String name)