Enum Toggle

java.lang.Object
java.lang.Enum<Toggle>
com.codename1.annotations.buildhints.Toggle
All Implemented Interfaces:
Comparable<Toggle>

public enum Toggle extends Enum<Toggle>

A build hint the build server reads as true or false, plus the state of not having said either.

Not boolean, which cannot express the third state. boolean x() default false is read by anyone looking at it -- and by IDE completion -- as "off unless you turn it on", which for many hints is simply untrue. It was harmless on the wire, because an attribute nobody writes is not written into the request either way, but it stated something about the build server that the client does not get to decide and cannot keep true.

So the third state is named instead of guessed. DEFAULT sends nothing and lets the server decide; ON and OFF are the developer overriding it.

  • Enum Constant Details

    • DEFAULT

      public static final Toggle DEFAULT
      Say nothing, and let the build server apply its own default.
    • ON

      public static final Toggle ON
      Turn the hint on, whatever the server would otherwise have done.
    • OFF

      public static final Toggle OFF
      Turn the hint off, whatever the server would otherwise have done.
  • Method Details

    • values

      public static Toggle[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static Toggle valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null