Annotation Interface Option


Annotation to define options for command arguments. This annotation can be used multiple times on the same method.

The value() method represents the key of the option, and the prefix() method defines the default prefix for options, which is -- by default.

Additional separators can be customized using the valueSeparator() and keySeparator() methods. By default, the value separator is a comma (,), and the key separator is an equals sign (=). The allowSeparating() method controls whether separating values is allowed, with the default set to true.

The Option.OptionContainer is a container annotation that allows the Option annotation to be repeatable on methods.

Author:
Despical

Created at 20.09.2024

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static @interface 
    Container annotation for holding multiple Option annotations on the same method.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Specifies the key of the option.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Determines whether separating multiple values is allowed.
    Specifies the separator between key and value.
    Specifies the prefix for the options.
    Specifies the separator used between values.
  • Element Details

    • value

      String value
      Specifies the key of the option.
      Returns:
      the option key
    • prefix

      String prefix
      Specifies the prefix for the options. Default is "--".
      Returns:
      the option prefix
      Default:
      "--"
    • valueSeparator

      String valueSeparator
      Specifies the separator used between values. Default is a comma ",".
      Returns:
      the value separator
      Default:
      ","
    • keySeparator

      String keySeparator
      Specifies the separator between key and value. Default is "=".
      Returns:
      the key-value separator
      Default:
      "="
    • allowSeparating

      boolean allowSeparating
      Determines whether separating multiple values is allowed. Default is true.
      Returns:
      true if separating is allowed, false otherwise
      Default:
      true