Annotation Interface RequiredUnlessEnvironment


@Retention(RUNTIME) @Target(FIELD) public @interface RequiredUnlessEnvironment
An annotation that indicates that an option/arguments is required UNLESS a specific environment variable is set.

This is intended for situations where your options are being populated by default values taken from environment variables and you only require the option if a suitable default is not already provided by the environment.

If you have other requirement criteria then you may wish to use Required, RequiredOnlyIf, RequireSome or RequireOnlyOne instead.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Specifies the name(s) of the environment variable that when present renders the option not required
  • Element Details

    • variables

      String[] variables
      Specifies the name(s) of the environment variable that when present renders the option not required
      Returns:
      Name(s) of the environment variables