|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.mmm.util.cli.base.CliClassContainer
net.sf.mmm.util.cli.base.CliState
public class CliState
This is a container for the state-class. It
determines and holds the CLI-informations of that state-class. In advance to CliClassContainer it also handles the CLI
specific property annotations.
| Nested Class Summary | |
|---|---|
protected static class |
CliState.CliArgumentFormatter
This inner class converts a CliArgumentContainer to a
String. |
| Nested classes/interfaces inherited from class net.sf.mmm.util.cli.base.CliClassContainer |
|---|
CliClassContainer.CliModeFormatter |
| Field Summary | |
|---|---|
private AnnotationUtil |
annotationUtil
|
private List<CliArgumentContainer> |
arguments
|
private Map<String,CliOptionContainer> |
name2OptionMap
|
private List<CliOptionContainer> |
optionList
|
private ReflectionUtil |
reflectionUtil
|
| Constructor Summary | |
|---|---|
CliState(Class<?> stateClass,
PojoDescriptorBuilderFactory descriptorBuilderFactory,
org.slf4j.Logger logger,
ReflectionUtil reflectionUtil,
AnnotationUtil annotationUtil)
The constructor. |
|
| Method Summary | |
|---|---|
private void |
addArgument(CliArgumentContainer argumentContainer)
This method registers the given
argument. |
private void |
addOption(CliOptionContainer optionContainer)
This method registers the given
option. |
private void |
addOption(String nameOrAlias,
CliOptionContainer option)
This method registers the given
option with the given name. |
protected boolean |
findPropertyAnnotations(PojoDescriptorBuilder descriptorBuilder)
This method finds the properties annotated with CliOption or
CliArgument. |
protected AnnotationUtil |
getAnnotationUtil()
|
Collection<CliArgumentContainer> |
getArguments()
This method gets the List of all CLI-arguments. |
List<CliArgumentContainer> |
getArguments(CliModeObject mode)
This method gets the List of CLI-arguments for the given mode. |
CliOptionContainer |
getOption(String nameOrAlias)
This method gets the option associated with the
given nameOrAlias. |
List<CliOptionContainer> |
getOptions()
This method gets the List of CLI-options
. |
Collection<CliOptionContainer> |
getOptions(CliModeObject mode)
This method gets the options for the given
mode. |
protected ReflectionUtil |
getReflectionUtil()
|
protected NodeCycle<CliArgumentContainer> |
initializeArgumentRecursive(BasicDoubleLinkedNode<CliArgumentContainer> node,
Map<String,BasicDoubleLinkedNode<CliArgumentContainer>> argumentMap)
This method initializes the node
containing an
CliArgumentContainer in order to determine the appropriate order of
the CliArguments. |
protected void |
initializeArguments()
This method initializes the arguments. |
protected CliModeObject |
requireMode(String id,
Object annotationContainer)
This method is like CliClassContainer.getMode(String) but also
handles the case
that a CliMode may be undefined. |
| Methods inherited from class net.sf.mmm.util.cli.base.CliClassContainer |
|---|
addMode, getCliClass, getCliStyle, getLogger, getMode, getModeIds, getName, getStateClass, initializeModeRecursive |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final ReflectionUtil reflectionUtil
getReflectionUtil()private final AnnotationUtil annotationUtil
getAnnotationUtil()private final Map<String,CliOptionContainer> name2OptionMap
getOption(String)private final List<CliOptionContainer> optionList
getOptions()private final List<CliArgumentContainer> arguments
getArguments()| Constructor Detail |
|---|
public CliState(Class<?> stateClass,
PojoDescriptorBuilderFactory descriptorBuilderFactory,
org.slf4j.Logger logger,
ReflectionUtil reflectionUtil,
AnnotationUtil annotationUtil)
stateClass - is the state-class.descriptorBuilderFactory - is the PojoDescriptorBuilderFactory
used to introspect the properties of
the stateClass.logger - is the Logger to use (e.g. for
CliStyleHandling).reflectionUtil - is the ReflectionUtil instance to use.annotationUtil - is the AnnotationUtil instance to use.| Method Detail |
|---|
protected AnnotationUtil getAnnotationUtil()
protected ReflectionUtil getReflectionUtil()
protected void initializeArguments()
arguments. This means that the
arguments are ordered properly.
CliArgument.addCloseTo(),
CliArgument.addAfter()
protected NodeCycle<CliArgumentContainer> initializeArgumentRecursive(BasicDoubleLinkedNode<CliArgumentContainer> node,
Map<String,BasicDoubleLinkedNode<CliArgumentContainer>> argumentMap)
throws NodeCycleException
node
containing an
CliArgumentContainer in order to determine the appropriate order of
the CliArguments.
node - is the node to initialize (link into the node-list).argumentMap - maps the id to the
according argument-node.
NodeCycle if a cyclic dependency has been detected but is
NOT yet complete or null if the initialization was
successful.
NodeCycleException - if a cyclic dependency was detected and
completed.protected boolean findPropertyAnnotations(PojoDescriptorBuilder descriptorBuilder)
CliOption or
CliArgument.
descriptorBuilder - is the PojoDescriptorBuilder to use
(determines if fields or setters are used).
true if at least one annotated property has been
found, false otherwise.
protected CliModeObject requireMode(String id,
Object annotationContainer)
CliClassContainer.getMode(String) but also
handles the case
that a CliMode may be undefined.
id - is the ID of the
requested CliMode.annotationContainer - is the CliArgumentContainer or
CliOptionContainer.
CliModeObject.private void addArgument(CliArgumentContainer argumentContainer)
registers the given
argument.
argumentContainer - is the argument to
register.private void addOption(CliOptionContainer optionContainer)
registers the given
option.
optionContainer - is the option to
register.
private void addOption(String nameOrAlias,
CliOptionContainer option)
registers the given
option with the given name.
nameOrAlias - is the CliOption.name() or
alias of the option.option - is the option to register.public CliOptionContainer getOption(String nameOrAlias)
option associated with the
given nameOrAlias.
nameOrAlias - is the CliOption.name() or
alias of the requested
option.
option or
null if no such option
exists.public List<CliOptionContainer> getOptions()
List of CLI-options
.
public Collection<CliArgumentContainer> getArguments()
List of all CLI-arguments.
public List<CliArgumentContainer> getArguments(CliModeObject mode)
List of CLI-arguments for the given mode.
mode - is the according mode.
public Collection<CliOptionContainer> getOptions(CliModeObject mode)
options for the given
mode.
mode - is the CliModeObject for which the options are required.
Collection with all options that are
compatible with the given
mode.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||