Record Class ChoiceOption<T>

java.lang.Object
java.lang.Record
com.ultikits.ultitools.ui.ChoiceOption<T>
Type Parameters:
T - value type
Record Components:
value - the non-null answer
label - the displayed label
tooltip - optional explanatory text

public record ChoiceOption<T>(T value, Text label, @Nullable Text tooltip) extends Record
One option of a Choice or ChoiceInput: a value and how it is shown. The caller must supply an immutable value to keep the containing intent immutable.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Text
    The field for the label record component.
    private final @Nullable Text
    The field for the tooltip record component.
    private final T
    The field for the value record component.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ChoiceOption(T value, Text label, @Nullable Text tooltip)
    Rejects a null value or label.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the label record component.
    static <T> ChoiceOption<T>
    of(T value, Text label)
    Creates an option without a tooltip.
    @Nullable Text
    Returns the value of the tooltip record component.
    final String
    Returns a string representation of this record class.
    Returns the value of the value record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • value

      private final T value
      The field for the value record component.
    • label

      private final Text label
      The field for the label record component.
    • tooltip

      @Nullable private final @Nullable Text tooltip
      The field for the tooltip record component.
  • Constructor Details

    • ChoiceOption

      public ChoiceOption(T value, Text label, @Nullable @Nullable Text tooltip)
      Rejects a null value or label.
  • Method Details

    • of

      public static <T> ChoiceOption<T> of(T value, Text label)
      Creates an option without a tooltip.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • value

      public T value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component
    • label

      public Text label()
      Returns the value of the label record component.
      Returns:
      the value of the label record component
    • tooltip

      @Nullable public @Nullable Text tooltip()
      Returns the value of the tooltip record component.
      Returns:
      the value of the tooltip record component