|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.crsh.cli.descriptor.CommandDescriptor<T>
public abstract class CommandDescriptor<T>
Field Summary | |
---|---|
private List<ArgumentDescriptor> |
arguments
. |
private Description |
description
. |
private boolean |
listArgument
. |
private Set<String> |
longOptionNames
. |
private static Set<String> |
MAIN_SINGLETON
. |
private String |
name
. |
private Map<String,OptionDescriptor> |
optionMap
. |
private List<OptionDescriptor> |
options
. |
private List<ParameterDescriptor> |
parameters
. |
private Set<String> |
shortOptionNames
. |
private List<ArgumentDescriptor> |
uArguments
. |
private Set<String> |
uLongOptionNames
. |
private Map<String,OptionDescriptor> |
uOptionMap
. |
private List<OptionDescriptor> |
uOptions
. |
private List<ParameterDescriptor> |
uParameters
. |
private Set<String> |
uShortOptionNames
. |
Constructor Summary | |
---|---|
protected |
CommandDescriptor(String name,
Description description)
|
Method Summary | |
---|---|
protected void |
addParameter(ParameterDescriptor parameter)
Add a parameter to the command. |
OptionDescriptor |
findOption(String name)
Find an command option by its name, this will look through the command hierarchy. |
ArgumentDescriptor |
getArgument(int index)
Returns a a specified argument by its index. |
List<ArgumentDescriptor> |
getArguments()
Returns a list of the command arguments. |
int |
getDepth()
|
Description |
getDescription()
Returns the command description. |
Set<String> |
getLongOptionNames()
Returns the command long option names. |
String |
getName()
Returns the command name. |
OptionDescriptor |
getOption(String name)
Returns a command option by its name. |
Set<String> |
getOptionNames()
Returns the command option names. |
Collection<OptionDescriptor> |
getOptions()
Returns the command options. |
abstract CommandDescriptor<T> |
getOwner()
|
List<ParameterDescriptor> |
getParameters()
Returns the command parameters, the returned collection contains the command options and the command arguments. |
Set<String> |
getShortOptionNames()
Returns the command short option names. |
abstract CommandDescriptor<T> |
getSubordinate(String name)
|
abstract Map<String,? extends CommandDescriptor<T>> |
getSubordinates()
Returns the command subordinates as a map. |
abstract Class<T> |
getType()
|
String |
getUsage()
Returns the command usage, shortcut for invoking getDescription().getUsage() on this
object. |
void |
printMan(Appendable writer)
|
void |
printUsage(Appendable writer)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Set<String> MAIN_SINGLETON
private final String name
private final Description description
private final Map<String,OptionDescriptor> optionMap
private final Set<String> shortOptionNames
private final Set<String> longOptionNames
private boolean listArgument
private final List<OptionDescriptor> options
private final List<ArgumentDescriptor> arguments
private final List<ParameterDescriptor> parameters
private final Map<String,OptionDescriptor> uOptionMap
private final Set<String> uShortOptionNames
private final Set<String> uLongOptionNames
private final List<OptionDescriptor> uOptions
private final List<ArgumentDescriptor> uArguments
private final List<ParameterDescriptor> uParameters
Constructor Detail |
---|
protected CommandDescriptor(String name, Description description) throws IntrospectionException
IntrospectionException
Method Detail |
---|
protected void addParameter(ParameterDescriptor parameter) throws IntrospectionException, NullPointerException, IllegalArgumentException
parameter
- the parameter to add
IntrospectionException
- any introspection exception that would prevent the parameter to be added
NullPointerException
- if the parameter is null
IllegalArgumentException
- if the parameter is already associated with another commandpublic abstract Class<T> getType()
public abstract CommandDescriptor<T> getOwner()
public final int getDepth()
public final void printUsage(Appendable writer) throws IOException
IOException
public final void printMan(Appendable writer) throws IOException
IOException
public abstract Map<String,? extends CommandDescriptor<T>> getSubordinates()
public abstract CommandDescriptor<T> getSubordinate(String name)
public final List<ParameterDescriptor> getParameters()
public final Set<String> getOptionNames()
public final Set<String> getShortOptionNames()
public final Set<String> getLongOptionNames()
public final Collection<OptionDescriptor> getOptions()
public final OptionDescriptor getOption(String name)
name
- the option name
public final OptionDescriptor findOption(String name)
name
- the option name
public final List<ArgumentDescriptor> getArguments()
public final ArgumentDescriptor getArgument(int index) throws IllegalArgumentException
index
- the argument index
IllegalArgumentException
- if the index is not within the boundspublic final String getName()
public final Description getDescription()
public final String getUsage()
getDescription().getUsage()
on this
object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |