Package org.apache.rat.ui
Class UIOptionCollection<T extends UIOption<T>>
java.lang.Object
org.apache.rat.ui.UIOptionCollection<T>
- Type Parameters:
T- the UIOption implementation.
- Direct Known Subclasses:
CLIOptionCollection
A collection of options supported by the UI. This includes RAT options and UI specific options.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classUIOptionCollection.Builder<T extends UIOption<T>,B extends UIOptionCollection.Builder<T, B>> Builder for a UIOptionCollection. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedUIOptionCollection(UIOptionCollection.Builder<T, ?> builder) Construct the UIOptionCollection from the builder. -
Method Summary
Modifier and TypeMethodDescriptionfinal org.apache.commons.cli.OptionsGets the additional Options understood by this collection.final StringdefaultValue(org.apache.commons.cli.Option option) Gets the default value for the option.getDescription(org.apache.commons.cli.Option option) Gets the description for the Option.getMappedOption(org.apache.commons.cli.Option option) Gets the UIOption instance for the Option.Gets the Stream of UIOption implementations understood by this collection.Gets a map client option name to the specified UIOption implementation.final org.apache.commons.cli.OptionsGets an Options that contains the Options and OptionGroups are understood by this collection.final Optional<org.apache.commons.cli.Option>getSelected(Arg arg) Gets the selected Option for an Arg.final org.apache.commons.cli.OptionsGets the collection of unsupported Options.final booleanisSelected(Arg arg) Checks if anArgis selected.rename(org.apache.commons.cli.Option option) Extracts the UI based name string for an option.voidResets the groups in the Args so that they are unused and ready to detect the next set of arguments.
-
Constructor Details
-
UIOptionCollection
Construct the UIOptionCollection from the builder.- Parameters:
builder- the Builder to build from.
-
-
Method Details
-
rename
Extracts the UI based name string for an option. The default implementation return the string returned byArgumentTracker.extractKey(Option)- Parameters:
option- the option to create the name for.- Returns:
- the name for the option in the UICollection name, may be the same as the option name.
-
isSelected
Checks if anArgis selected.- Parameters:
arg- the Arg to check.- Returns:
trueif the arg is selected.
-
getSelected
Gets the selected Option for an Arg.- Parameters:
arg- the Arg to get the Option for..- Returns:
- an Optional containing the selected option, or an empty Optional if none was selected.
-
resetSelected
public void resetSelected()Resets the groups in the Args so that they are unused and ready to detect the next set of arguments. -
getUnsupportedOptions
public final org.apache.commons.cli.Options getUnsupportedOptions()Gets the collection of unsupported Options.- Returns:
- the Options comprising the unsupported options.
-
getMappedOption
Gets the UIOption instance for the Option.- Parameters:
option- the option to find the instance of.- Returns:
- an Optional containing the UIOption for the option, or an empty Optional if the option is not in the UI.
-
getOptions
public final org.apache.commons.cli.Options getOptions()Gets an Options that contains the Options and OptionGroups are understood by this collection. OptionGroups are registered in the resulting Options object.- Returns:
- an Options that contains the
Argdefined Option instances that are understood by this collection as well as any additional custom Options.
-
getMappedOptions
Gets the Stream of UIOption implementations understood by this collection.- Returns:
- the Stream of UIOption implementations understood by this collection.
-
getOptionMap
Gets a map client option name to the specified UIOption implementation.- Returns:
- a map client option name to the specified UIOption implementation.
-
additionalOptions
public final org.apache.commons.cli.Options additionalOptions()Gets the additional Options understood by this collection.- Returns:
- the additional Options understood by this collection.
-
defaultValue
Gets the default value for the option.- Parameters:
option- the option to lookup.- Returns:
- the default value or
nullif not set.
-
getDescription
Gets the description for the Option. Default implementation is based on the description in the option itself as well as the deprecated state.- Parameters:
option- the option to get the description for.- Returns:
- the description of the option.
-