de.tototec.cmdoption
Annotation Type CmdOption


@Retention(value=RUNTIME)
@Target(value={FIELD,METHOD})
@Documented
public @interface CmdOption

An Command line option which optionally supports parameters. It can be used to annotate fields and methods as options. At most on field or method can be annotated with an zero names attribute, which means that field or method represents the main parameter .


Optional Element Summary
 java.lang.String[] args
          The arguments (their names) supported by this option.
 java.lang.String[] conflictsWith
          If this option can not be used in conjunction with an specific other option, you should declare those conflicting options here.
 java.lang.String description
          The description of the option.
 java.lang.Class<? extends CmdOptionHandler> handler
          An CmdOptionHandler to apply the parsed option to the annotated field or method.
 boolean hidden
          If true, do not show this option in the usage.
 boolean isHelp
          Special marker, that this option is a help request.
 int maxCount
          The maximal allowed count this option can be specified.
 int minCount
          The minimal allowed count this option can be specified.
 java.lang.String[] names
          The names of this option.
 java.lang.String[] requires
          If this option is only valid in conjunction with other options, you should declare those other options here.
 

names

public abstract java.lang.String[] names
The names of this option. If not specified, the annotated field or method represents the main parameter. At most on main parameter is allowed.

Default:
{}

description

public abstract java.lang.String description
The description of the option.

Default:
""

args

public abstract java.lang.String[] args
The arguments (their names) supported by this option. The count of arguments is used, to determite the CmdOptionHandler to use. The names are used in messages and the usage display.

Default:
{}

handler

public abstract java.lang.Class<? extends CmdOptionHandler> handler
An CmdOptionHandler to apply the parsed option to the annotated field or method. If this is not given, all handler registered for auto-detect will by tried in order.

See Also:
CmdlineParser.registerHandler(CmdOptionHandler)
Default:
de.tototec.cmdoption.handler.CmdOptionHandler.class

minCount

public abstract int minCount
The minimal allowed count this option can be specified. Optional options have 0 here, which is the default.

Default:
0

maxCount

public abstract int maxCount
The maximal allowed count this option can be specified. Use -1 to specify infinity.

Default:
1

isHelp

public abstract boolean isHelp
Special marker, that this option is a help request. Typically, such an option is used to display a usage information to the user and exit. If such an option is parsed, validation will be disabled to allow help request even when the command line is incorrect.

Default:
false

hidden

public abstract boolean hidden
If true, do not show this option in the usage.

Default:
false

requires

public abstract java.lang.String[] requires
If this option is only valid in conjunction with other options, you should declare those other options here.

Default:
{}

conflictsWith

public abstract java.lang.String[] conflictsWith
If this option can not be used in conjunction with an specific other option, you should declare those conflicting options here.

Default:
{}