Record Class ConfigurationScreen.UndoManager.Step<T>

java.lang.Object
java.lang.Record
net.neoforged.neoforge.client.gui.ConfigurationScreen.UndoManager.Step<T>
Enclosing class:
ConfigurationScreen.UndoManager

public static record ConfigurationScreen.UndoManager.Step<T>(Consumer<T> run, T newValue, Consumer<T> undo, T oldValue) extends Record
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final T
    The field for the newValue record component.
    private final T
    The field for the oldValue record component.
    private final Consumer<T>
    The field for the run record component.
    private final Consumer<T>
    The field for the undo record component.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Step(Consumer<T> run, T newValue, Consumer<T> undo, T oldValue)
    Creates an instance of a Step record class.
  • 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 newValue record component.
    Returns the value of the oldValue record component.
    run()
    Returns the value of the run record component.
    private void
     
    private void
     
    final String
    Returns a string representation of this record class.
    Returns the value of the undo record component.

    Methods inherited from class java.lang.Object

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

    • run

      private final Consumer<T> run
      The field for the run record component.
    • newValue

      private final T newValue
      The field for the newValue record component.
    • undo

      private final Consumer<T> undo
      The field for the undo record component.
    • oldValue

      private final T oldValue
      The field for the oldValue record component.
  • Constructor Details

    • Step

      public Step(Consumer<T> run, T newValue, Consumer<T> undo, T oldValue)
      Creates an instance of a Step record class.
      Parameters:
      run - the value for the run record component
      newValue - the value for the newValue record component
      undo - the value for the undo record component
      oldValue - the value for the oldValue record component
  • Method Details

    • runUndo

      private void runUndo()
    • runRedo

      private void runRedo()
    • 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.
    • run

      public Consumer<T> run()
      Returns the value of the run record component.
      Returns:
      the value of the run record component
    • newValue

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

      public Consumer<T> undo()
      Returns the value of the undo record component.
      Returns:
      the value of the undo record component
    • oldValue

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