org.crsh.cmdline
Class ClassDescriptor<T>

java.lang.Object
  extended by org.crsh.cmdline.CommandDescriptor<T,ClassFieldBinding>
      extended by org.crsh.cmdline.ClassDescriptor<T>

public class ClassDescriptor<T>
extends CommandDescriptor<T,ClassFieldBinding>

A command backed by a class.

Version:
$Revision$
Author:
Julien Viet

Field Summary
private static org.slf4j.Logger log
          .
private  Map<String,MethodDescriptor<T>> methodMap
          .
private  Class<T> type
          .
 
Constructor Summary
ClassDescriptor(Class<T> type, Description info)
           
 
Method Summary
(package private)  void addParameter(ParameterDescriptor<ClassFieldBinding> parameter)
          Add a parameter to the command.
private  List<MethodDescriptor<T>> commands(Class<?> introspected)
           
 OptionDescriptor<?> findOption(String name)
          Find an command option by its name.
 MethodDescriptor<T> getMethod(String name)
           
 Iterable<MethodDescriptor<T>> getMethods()
           
 Map<String,? extends CommandDescriptor<T,?>> getSubordinates()
          Returns the command subordinates as a map.
 Class<T> getType()
           
 void printMan(Appendable writer)
           
 void printUsage(Appendable writer)
           
 
Methods inherited from class org.crsh.cmdline.CommandDescriptor
getArgument, getArguments, getDescription, getLongOptionNames, getName, getOption, getOptionNames, getOptions, getParameters, getShortOptionNames, getUsage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.slf4j.Logger log
.


type

private final Class<T> type
.


methodMap

private final Map<String,MethodDescriptor<T>> methodMap
.

Constructor Detail

ClassDescriptor

public ClassDescriptor(Class<T> type,
                       Description info)
                throws IntrospectionException
Throws:
IntrospectionException
Method Detail

addParameter

void addParameter(ParameterDescriptor<ClassFieldBinding> parameter)
            throws IntrospectionException
Description copied from class: CommandDescriptor
Add a parameter to the command.

Overrides:
addParameter in class CommandDescriptor<T,ClassFieldBinding>
Parameters:
parameter - the parameter to add
Throws:
IntrospectionException - any introspection exception that would prevent the parameter to be added

getType

public Class<T> getType()
Specified by:
getType in class CommandDescriptor<T,ClassFieldBinding>

getSubordinates

public Map<String,? extends CommandDescriptor<T,?>> getSubordinates()
Description copied from class: CommandDescriptor
Returns the command subordinates as a map.

Specified by:
getSubordinates in class CommandDescriptor<T,ClassFieldBinding>
Returns:
the subordinates

findOption

public OptionDescriptor<?> findOption(String name)
Description copied from class: CommandDescriptor
Find an command option by its name.

Specified by:
findOption in class CommandDescriptor<T,ClassFieldBinding>
Parameters:
name - the option name
Returns:
the option

printUsage

public void printUsage(Appendable writer)
                throws IOException
Specified by:
printUsage in class CommandDescriptor<T,ClassFieldBinding>
Throws:
IOException

printMan

public void printMan(Appendable writer)
              throws IOException
Specified by:
printMan in class CommandDescriptor<T,ClassFieldBinding>
Throws:
IOException

getMethods

public Iterable<MethodDescriptor<T>> getMethods()

getMethod

public MethodDescriptor<T> getMethod(String name)

commands

private List<MethodDescriptor<T>> commands(Class<?> introspected)
                                    throws IntrospectionException
Throws:
IntrospectionException


Copyright © 2012 eXo Platform SAS. All Rights Reserved.