Class AbstractOption

java.lang.Object
org.apache.rat.documentation.options.AbstractOption
Direct Known Subclasses:
AntOption, CLIOption, MavenOption

public abstract class AbstractOption extends Object
Abstract class that provides the framework for UI-specific RAT options. In this context UI option means an option expressed in the specific UI, such as:
See Also:
AntOption, MavenOption, CLIOption
  • Field Details

    • PATTERN

      protected static final Pattern PATTERN
      The pattern to match CLI options in text
    • option

      protected final org.apache.commons.cli.Option option
      The actual UI-specific name for the option
    • name

      protected final String name
      The name for the option
    • argumentType

      protected final OptionCollection.ArgumentType argumentType
      The argument type for this option
  • Method Details

    • getOption

      public org.apache.commons.cli.Option getOption()
      Gets the option this abstract option is wrapping.
      Returns:
      the original Option.
    • getDefaultValue

      public String getDefaultValue()
      Return default value.
      Returns:
      default value or null if no argument given.
    • cleanupName

      protected abstract String cleanupName(org.apache.commons.cli.Option option)
      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

      public abstract String 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.
    • cleanupName

      public String cleanupName()
      Gets this option's cleaned up name.
      Returns:
      This option's cleaned up name.
    • cleanup

      public String cleanup(String str)
      Replaces CLI pattern options with implementation specific pattern options.
      Parameters:
      str - the string to clean.
      Returns:
      the string with CLI names replaced with implementation specific names.
    • getName

      public final String getName()
      Gets the implementation specific name for the CLI option.
      Returns:
      The implementation specific name for the CLI option.
    • getText

      public abstract String 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

      public final String getDescription()
      Gets the description in implementation specific format.
      Returns:
      the description or an empty string.
    • getType

      public final Class<?> getType()
      Gets the simple class name for the data type for this option. Normally "String".
      Returns:
      the simple class name for the type.
    • getArgName

      public final String getArgName()
      Gets the argument name if there is one.
      Returns:
      the Argument name
    • getArgType

      public final OptionCollection.ArgumentType 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:
      true if the option is deprecated
    • isRequired

      public final boolean isRequired()
      Determines if the option is required.
      Returns:
      true if the option is required.
    • hasArg

      public final boolean hasArg()
      Determine if the enclosed option expects an argument.
      Returns:
      true if the enclosed option expects at least one argument.
    • hasArgs

      public final boolean hasArgs()
      Returns true if the option has multiple arguments.
      Returns:
      true if the option has multiple arguments.
    • argCount

      public final int argCount()
      Returns the number of arguments.
      Returns:
      The number of arguments.
    • keyValue

      public final String keyValue()
      The key value for the option.
      Returns:
      the key value for the CLI argument map.
    • getDeprecated

      public final String 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.