Class UIOption<T extends UIOption<T>>
java.lang.Object
org.apache.rat.ui.UIOption<T>
- Type Parameters:
T- the concrete implementation of AbstractOption.
- Direct Known Subclasses:
AntOption, CLIOption, MavenOption
Abstract class that provides the framework for UI-specific RAT options.
In this context UI option means an option expressed in the specific UI.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final OptionCollection.ArgumentTypeThe argument type for this optionprotected final CasedStringThe name for the optionprotected final org.apache.commons.cli.OptionThe actual UI-specific name for the optionprotected final UIOptionCollection<T> The AbstractOptionCollection associated with this AbstractOptionprotected static final PatternThe pattern to match CLI options in text -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected <C extends UIOptionCollection<T>>UIOption(C optionCollection, org.apache.commons.cli.Option option, CasedString name) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionReplaces CLI pattern options with implementation specific pattern options.protected abstract StringcleanupName(org.apache.commons.cli.Option option) Provide means to wrap the given option depending on the UI-specific option implementation.final StringGets the argument name if there is one.Gets the argument type if there is one.final CasedStringGets the CasedString version of the name for the native UI.final StringReturn default value.final StringGets the deprecated string if the option is deprecated, or an empty string otherwise.final StringGets the description in implementation specific format.abstract StringGets an example of how to use this option in the native UI.final StringgetName()Gets the implementation specific name for the native UI.final org.apache.commons.cli.OptionGets the option this abstract option is wrapping.final <X extends UIOptionCollection<T>>
XGets the AbstractOptionCollection that this option is a member of.abstract StringgetText()return a string showing long and short options if they are available.final Class<?> getType()Gets the simple class name for the data type for this option.final booleanhasArg()Determine if the enclosed option expects an argument.final booleanhasArgs()Returnstrueif the option has multiple arguments.final booleanDetermines if the option is deprecated.final booleanDetermines if the option is required.final StringkeyValue()The key value for the option.
-
Field Details
-
PATTERN
The pattern to match CLI options in text -
option
protected final org.apache.commons.cli.Option optionThe actual UI-specific name for the option -
name
The name for the option -
argumentType
The argument type for this option -
optionCollection
The AbstractOptionCollection associated with this AbstractOption
-
-
Constructor Details
-
UIOption
protected <C extends UIOptionCollection<T>> UIOption(C optionCollection, org.apache.commons.cli.Option option, CasedString name) Constructor.- Parameters:
option- The CLI optionname- the UI-specific name for the option
-
-
Method Details
-
getOptionCollection
Gets the AbstractOptionCollection that this option is a member of.- Returns:
- the AbstractOptionCollection that this option is a member of.
-
getOption
public final org.apache.commons.cli.Option getOption()Gets the option this abstract option is wrapping.- Returns:
- the original Option.
-
getDefaultValue
Return default value.- Returns:
- default value or
nullif no argument given.
-
cleanupName
Provide means to wrap the given option depending on the UI-specific option implementation.- Parameters:
option- The CLI option- Returns:
- the cleaned up option name.
-
getExample
Gets an example of how to use this option in the native UI.- Returns:
- An example of how to use this option in the native UI.
-
cleanup
-
getName
Gets the implementation specific name for the native UI.- Returns:
- The implementation specific name for the native UI.
-
getCasedName
Gets the CasedString version of the name for the native UI.- Returns:
- the CasedString version of the name for the native UI.
-
getText
return a string showing long and short options if they are available. Will return a string.- Returns:
- A string showing long and short options if they are available. Never
null.
-
getDescription
Gets the description in implementation specific format.- Returns:
- the description or an empty string.
-
getType
Gets the simple class name for the data type for this option. Normally "String".- Returns:
- the simple class name for the type.
-
getArgName
-
getArgType
Gets the argument type if there is one.- Returns:
- the Argument name
-
isDeprecated
public final boolean isDeprecated()Determines if the option is deprecated.- Returns:
trueif the option is deprecated
-
isRequired
public final boolean isRequired()Determines if the option is required.- Returns:
trueif the option is required.
-
hasArg
public final boolean hasArg()Determine if the enclosed option expects an argument.- Returns:
trueif the enclosed option expects at least one argument.
-
hasArgs
public final boolean hasArgs()Returnstrueif the option has multiple arguments.- Returns:
trueif the option has multiple arguments.
-
keyValue
The key value for the option.- Returns:
- the key value for the CLI argument map.
-
getDeprecated
Gets the deprecated string if the option is deprecated, or an empty string otherwise.- Returns:
- the deprecated string if the option is deprecated, or an empty string otherwise.
-