Record Class MigrationResult.Failure

java.lang.Object
java.lang.Record
net.blockhost.commons.config.migration.MigrationResult.Failure
All Implemented Interfaces:
MigrationResult
Enclosing interface:
MigrationResult

public static record MigrationResult.Failure(int fromVersion, int toVersion, List<MigrationResult.MigrationStep> steps, Duration duration, Map<String,Object> data, MigrationException cause) extends Record implements MigrationResult
Represents a failed migration result.
  • Constructor Details

    • Failure

      public Failure(int fromVersion, int toVersion, List<MigrationResult.MigrationStep> steps, Duration duration, Map<String,Object> data, MigrationException cause)
      Creates an instance of a Failure record class.
      Parameters:
      fromVersion - the value for the fromVersion record component
      toVersion - the value for the toVersion record component
      steps - the value for the steps record component
      duration - the value for the duration record component
      data - the value for the data record component
      cause - the value for the cause record component
  • Method Details

    • isSuccess

      public boolean isSuccess()
      Description copied from interface: MigrationResult
      Returns whether the migration completed successfully.
      Specified by:
      isSuccess in interface MigrationResult
      Returns:
      true if all migrations were applied successfully
    • error

      public Optional<MigrationException> error()
      Description copied from interface: MigrationResult
      Returns the error if the migration failed.
      Specified by:
      error in interface MigrationResult
      Returns:
      an Optional containing the exception if failed, empty if successful
    • 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.
    • fromVersion

      public int fromVersion()
      Returns the value of the fromVersion record component.
      Specified by:
      fromVersion in interface MigrationResult
      Returns:
      the value of the fromVersion record component
    • toVersion

      public int toVersion()
      Returns the value of the toVersion record component.
      Specified by:
      toVersion in interface MigrationResult
      Returns:
      the value of the toVersion record component
    • steps

      Returns the value of the steps record component.
      Specified by:
      steps in interface MigrationResult
      Returns:
      the value of the steps record component
    • duration

      public Duration duration()
      Returns the value of the duration record component.
      Specified by:
      duration in interface MigrationResult
      Returns:
      the value of the duration record component
    • data

      public Map<String,Object> data()
      Returns the value of the data record component.
      Specified by:
      data in interface MigrationResult
      Returns:
      the value of the data record component
    • cause

      public MigrationException cause()
      Returns the value of the cause record component.
      Returns:
      the value of the cause record component