Class UIOptionCollection<T extends UIOption<T>>

java.lang.Object
org.apache.rat.ui.UIOptionCollection<T>
Type Parameters:
T - the UIOption implementation.
Direct Known Subclasses:
AntOptionCollection, BaseOptionCollection, CLIOptionCollection, MavenOptionCollection

public class UIOptionCollection<T extends UIOption<T>> extends Object
A collection of options supported by the UI. This includes RAT options and UI specific options.
  • Constructor Details

    • UIOptionCollection

      protected UIOptionCollection(UIOptionCollection.Builder<T,?> builder)
      Construct the UIOptionCollection from the builder.
      Parameters:
      builder - the Builder to build from.
  • Method Details

    • rename

      public String rename(org.apache.commons.cli.Option option)
      Extracts the UI based name string for an option. The default implementation return the string returned by ArgumentTracker.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

      public final boolean isSelected(Arg arg)
      Checks if an Arg is selected.
      Parameters:
      arg - the Arg to check.
      Returns:
      true if the arg is selected.
    • getSelected

      public final Optional<org.apache.commons.cli.Option> getSelected(Arg arg)
      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

      public final Optional<T> getMappedOption(org.apache.commons.cli.Option option)
      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 Arg defined Option instances that are understood by this collection as well as any additional custom Options.
    • getMappedOptions

      public final Stream<T> getMappedOptions()
      Gets the Stream of UIOption implementations understood by this collection.
      Returns:
      the Stream of UIOption implementations understood by this collection.
    • getOptionMap

      public final Map<String,T> 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

      public final String defaultValue(org.apache.commons.cli.Option option)
      Gets the default value for the option.
      Parameters:
      option - the option to lookup.
      Returns:
      the default value or null if not set.
    • getDescription

      public String getDescription(org.apache.commons.cli.Option option)
      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.