org.crsh.cmdline
Class CommandDescriptor<T,B extends TypeBinding>

java.lang.Object
  extended by org.crsh.cmdline.CommandDescriptor<T,B>
Direct Known Subclasses:
ClassDescriptor, MethodDescriptor

public abstract class CommandDescriptor<T,B extends TypeBinding>
extends Object

Describes a command.

Version:
$Revision$
Author:
Julien Viet

Method Summary
abstract  OptionDescriptor<?> findOption(String name)
          Find an command option by its name.
 ArgumentDescriptor<B> getArgument(int index)
          Returns a a specified argument by its index.
 List<ArgumentDescriptor<B>> getArguments()
          Returns a list of the command arguments.
 Description getDescription()
          Returns the command description.
 Set<String> getLongOptionNames()
          Returns the command long option names.
 String getName()
          Returns the command name.
 OptionDescriptor<B> getOption(String name)
          Returns a command option by its name.
 Set<String> getOptionNames()
          Returns the command option names.
 Collection<OptionDescriptor<B>> getOptions()
          Returns the command options.
 Collection<ParameterDescriptor<B>> 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  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.
abstract  void printMan(Appendable writer)
           
abstract  void printUsage(Appendable writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getType

public abstract Class<T> getType()

printUsage

public abstract void printUsage(Appendable writer)
                         throws IOException
Throws:
IOException

printMan

public abstract void printMan(Appendable writer)
                       throws IOException
Throws:
IOException

getSubordinates

public abstract Map<String,? extends CommandDescriptor<T,?>> getSubordinates()
Returns the command subordinates as a map.

Returns:
the subordinates

getParameters

public final Collection<ParameterDescriptor<B>> getParameters()
Returns the command parameters, the returned collection contains the command options and the command arguments.

Returns:
the command parameters

getOptionNames

public final Set<String> getOptionNames()
Returns the command option names.

Returns:
the command option names

getShortOptionNames

public final Set<String> getShortOptionNames()
Returns the command short option names.

Returns:
the command long option names

getLongOptionNames

public final Set<String> getLongOptionNames()
Returns the command long option names.

Returns:
the command long option names

getOptions

public final Collection<OptionDescriptor<B>> getOptions()
Returns the command options.

Returns:
the command options

getOption

public final OptionDescriptor<B> getOption(String name)
Returns a command option by its name.

Parameters:
name - the option name
Returns:
the option

findOption

public abstract OptionDescriptor<?> findOption(String name)
Find an command option by its name.

Parameters:
name - the option name
Returns:
the option

getArguments

public final List<ArgumentDescriptor<B>> getArguments()
Returns a list of the command arguments.

Returns:
the command arguments

getArgument

public final ArgumentDescriptor<B> getArgument(int index)
                                                            throws IllegalArgumentException
Returns a a specified argument by its index.

Returns:
the command argument
Throws:
IllegalArgumentException - if the index is not within the bounds

getName

public final String getName()
Returns the command name.

Returns:
the command name

getDescription

public final Description getDescription()
Returns the command description.

Returns:
the command description

getUsage

public final String getUsage()
Returns the command usage, shortcut for invoking getDescription().getUsage() on this object.

Returns:
the command usage


Copyright © 2011 eXo Platform SAS. All Rights Reserved.