Enum Class Op

java.lang.Object
java.lang.Enum<Op>
org.apache.juneau.console.widgets.Op
All Implemented Interfaces:
Serializable, Comparable<Op>, Constable

public enum Op extends Enum<Op>
The comparison operator of a declarative single-field rule.

One vocabulary, one place. Every rule in the toolkit that tests one row field against one value shares these constants — the action-bar state rule here, and the RowClassRule row decorator in the views module, and the views module's VisibilityRule. It lives in this module because the widgets→views dependency does not exist, so the shared type has to sit on the side both can see.

IN/CONTAINS are collection operators (the value is a list, or the tested field is) used by visibility rules only.

EQ/NE/IN/CONTAINS require a comparison value; PRESENT/ABSENT test only whether the field is non-null/non-empty and therefore omit one. requiresValue() is the discriminator, and every host is expected to reject the mismatched form rather than ignore the surplus value.

Each constant also carries its lowercase wire token, for the hosts that do serialize a rule.

Since:
10.0.0
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Matches when the tested field is missing/null (no value needed).
    Matches when the tested field (itself a list) contains the rule's value.
    Matches when the tested field equals the rule value.
    Matches when the tested field equals one of the values in the rule's value list (the value is a list).
    Matches when the tested field does not equal the rule value.
    Matches when the tested field is non-null/non-empty (no value needed).
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Whether this operator is a collection operator (IN/CONTAINS).
    boolean
    Whether this operator requires a comparison value (EQ/NE/IN/CONTAINS).
    static Op
    Returns the enum constant of this class with the specified name.
    static Op[]
    Returns an array containing the constants of this enum class, in the order they are declared.
    Returns the lowercase wire token for this operator.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • EQ

      public static final Op EQ
      Matches when the tested field equals the rule value.
    • NE

      public static final Op NE
      Matches when the tested field does not equal the rule value.
    • PRESENT

      public static final Op PRESENT
      Matches when the tested field is non-null/non-empty (no value needed).
    • ABSENT

      public static final Op ABSENT
      Matches when the tested field is missing/null (no value needed).
    • IN

      public static final Op IN
      Matches when the tested field equals one of the values in the rule's value list (the value is a list).
    • CONTAINS

      public static final Op CONTAINS
      Matches when the tested field (itself a list) contains the rule's value.
  • Method Details

    • values

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

      public static Op valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null
    • wire

      public String wire()
      Returns the lowercase wire token for this operator.
      Returns:
      The wire token (e.g. "eq").
    • requiresValue

      public boolean requiresValue()
      Whether this operator requires a comparison value (EQ/NE/IN/CONTAINS).
      Returns:
      true for EQ, NE, IN and CONTAINS, false for PRESENT and ABSENT.
    • isCollectionOp

      public boolean isCollectionOp()
      Whether this operator is a collection operator (IN/CONTAINS).

      Only the visibility rule evaluator understands these; the disable-with-reason rules accept the original four.

      Returns:
      true for IN and CONTAINS.