Record Class DataListStateTransition

java.lang.Object
java.lang.Record
fr.becpg.repo.activity.data.DataListStateTransition
Record Components:
beforeState - the state of the list before the change
afterState - the state of the list after the change

public record DataListStateTransition(String beforeState, String afterState) extends Record
Change of the validation state of a data list, from one state to another. A list without any state is to be validated, so a missing or blank state is read as EntityListState.ToValidate.
Author:
valentin
  • Field Details

    • beforeState

      private final String beforeState
      The field for the beforeState record component.
    • afterState

      private final String afterState
      The field for the afterState record component.
  • Constructor Details

    • DataListStateTransition

      public DataListStateTransition(String beforeState, String afterState)
      Creates an instance of a DataListStateTransition record class.
      Parameters:
      beforeState - the value for the beforeState record component
      afterState - the value for the afterState record component
  • Method Details

    • between

      public static Optional<DataListStateTransition> between(Serializable before, Serializable after)
      Builds the transition between two raw values of the list state property.
      Parameters:
      before - the property value before the update, possibly null
      after - the property value after the update, possibly null
      Returns:
      the transition, or empty when the effective state did not change
    • effectiveState

      private static String effectiveState(Serializable state)
    • 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.
    • beforeState

      public String beforeState()
      Returns the value of the beforeState record component.
      Returns:
      the value of the beforeState record component
    • afterState

      public String afterState()
      Returns the value of the afterState record component.
      Returns:
      the value of the afterState record component