net.sf.mmm.util.cli.api
Annotation Type CliMode


@Retention(value=RUNTIME)
@Target(value=TYPE)
@Documented
public @interface CliMode

A CliMode is used to annotate a CLI annotated class in order to define a operational mode. Such mode is referred by a CliOption or CliArgument in order to group them. This allows to express which options and arguments can be mixed and which of them should NOT go together.
E.g. the options "--help" does NOT make sense to be mixed with "--shutdown". Within some mode, options may be required but in another mode they should NOT be present.
When commandline parameters are parsed the CliMode is automatically detected and returned. This makes it even easier to implement your main-program and decide what to do.
A CliMode can also be abstract. Such mode can NOT be triggered so an option (or argument) with an abstract mode can only be used together with another one that has a mode that is NOT abstract and extends the abstract mode.

Since:
2.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
See Also:
CliModes, CliOption.mode(), CliParser.parseParameters(String...)

Required Element Summary
 String id
          The unique id of this CliMode.
 
Optional Element Summary
 boolean isAbstract
          true if this mode is abstract, false otherwise (default).
 String[] parentIds
          The IDs of the modes to extend.
 String title
          The title of this CliMode for displaying in help-usage for the end-user.
 String usage
          A brief description of what the program actually does in this mode.
 

Element Detail

id

public abstract String id
The unique id of this CliMode. Should match to mode of options.

title

public abstract String title
The title of this CliMode for displaying in help-usage for the end-user. The default is the empty string that is treated as fallback to show the ID as title.

See Also:
NlsMessage
Default:
""

usage

public abstract String usage
A brief description of what the program actually does in this mode. If not present no explicit description will be printed.

Default:
""

parentIds

public abstract String[] parentIds
The IDs of the modes to extend.
If you have two options with different modes and the first extends the second, then the two options can be used together and the mode of the extended mode is chosen. For the chosen mode and all modes inherited (recursively) all required options have to be present.

Default:
{}

isAbstract

public abstract boolean isAbstract
true if this mode is abstract, false otherwise (default).
An abstract mode needs to have one or multiple child modes (that extend the abstract mode). If an option has a mode, that is abstract, then this option can only be used together with another option that has a mode that is NOT abstract and extends the abstract mode.

Default:
false


Copyright © 2001-2010 mmm-Team. All Rights Reserved.