Record Class DialogInput.SingleOption.Entry

java.lang.Object
java.lang.Record
fr.fidorial.dialog.DialogInput.SingleOption.Entry
Record Components:
id - the value sent when this entry is picked
display - how the entry reads on screen, or null to display id
initial - whether the control starts on this entry
Enclosing class:
DialogInput.SingleOption

public static record DialogInput.SingleOption.Entry(String id, @Nullable Component display, boolean initial) extends Record
One entry of a DialogInput.SingleOption control.
Since:
0.1.0
  • Constructor Details

    • Entry

      public Entry(String id, @Nullable Component display, boolean initial)
      Creates an instance of a Entry record class.
      Parameters:
      id - the value for the id record component
      display - the value for the display record component
      initial - the value for the initial record component
  • Method Details

    • of

      @Contract("_ -> new") public static DialogInput.SingleOption.Entry of(String id)
      Creates an entry displaying its own identifier.
      Parameters:
      id - the value sent when this entry is picked
      Returns:
      the entry
      Since:
      0.1.0
    • of

      @Contract("_, _ -> new") public static DialogInput.SingleOption.Entry of(String id, ComponentLike display)
      Parameters:
      id - the value sent when this entry is picked
      display - how the entry reads on screen
      Returns:
      the entry
      Since:
      0.1.0
    • asInitial

      @Contract("-> new") public DialogInput.SingleOption.Entry asInitial()
      Returns a copy of this entry the control starts on.
      Returns:
      a copy of this entry the control starts on
      Since:
      0.1.0
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • display

      public @Nullable Component display()
      Returns the value of the display record component.
      Returns:
      the value of the display record component
    • initial

      public boolean initial()
      Returns the value of the initial record component.
      Returns:
      the value of the initial record component