Annotation Type Option


  • @IgnoreInWholeProgramInference
    @Retention(RUNTIME)
    @Target(FIELD)
    public @interface Option
    Indicates that the annotated field is set via a command-line option.

    Here are examples of use:

       @Option("-o <filename> the output file ")
       public static File outfile = new File("/tmp/foobar");
    
       @Option("-i ignore case")
       public static boolean ignore_case;
    
       @Option("set the initial temperature")
       public static double temperature = 75.0;
     
    See the documentation for the elements of this annotation (just below).

    Also see the documentation for the Options class, which processes the command-line options.

    See Also:
    Options, OptionGroup, Unpublicized, OptionsDoclet
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      java.lang.String value
      A string that describes the option.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String[] aliases
      Aliases for this option, which a user can use instead of the option's standard name.
      boolean noDocDefault
      If true, OptionsDoclet does not report the field's default value.
    • Element Detail

      • value

        java.lang.String value
        A string that describes the option. The format is " [-c] [<type>] description":
        • "-c" is an optional single-character short name for the option.
        • "<type>" is an optional description of the option type, to be displayed instead of its Java type (e.g., "<filename>" if the variable's type is String). The less-than and greater-than symbols are required.
        • "description" is a short (one-line) description of the option suitable for a usage message. By convention, it starts with a capital letter but does not end with a period. The field's Javadoc comment should contain a longer description appropriate for a manual or manpage. The Javadoc comment often repeats something similar to the @Option description.
        Returns:
        a string that describes this option
        See Also:
        Option
      • aliases

        java.lang.String[] aliases
        Aliases for this option, which a user can use instead of the option's standard name. For example, "--optimize" and "--optimise" might be two aliases that may be used interchangeably.

        Each string includes leading hyphens, as in

         @Option(value = "Print the program version", aliases = {"-v", "-version", "--version"})
         
        If there is only a single, one-character alias, it can be put at the beginning of the value field without the need for an aliases element.

        For more information about the use of this field, see the section on "Option aliases" in Options.

        Returns:
        aliases for this option; each string includes as many leading hyphens as a user should type
        Default:
        {}
      • noDocDefault

        boolean noDocDefault
        If true, OptionsDoclet does not report the field's default value.
        Returns:
        whether not to hide default values
        Default:
        false