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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface MigrationResult
MigrationResult.Builder, MigrationResult.Failure, MigrationResult.MigrationStep, MigrationResult.Success -
Constructor Summary
ConstructorsConstructorDescriptionFailure(int fromVersion, int toVersion, List<MigrationResult.MigrationStep> steps, Duration duration, Map<String, Object> data, MigrationException cause) Creates an instance of aFailurerecord class. -
Method Summary
Modifier and TypeMethodDescriptioncause()Returns the value of thecauserecord component.data()Returns the value of thedatarecord component.duration()Returns the value of thedurationrecord component.final booleanIndicates whether some other object is "equal to" this one.error()Returns the error if the migration failed.intReturns the value of thefromVersionrecord component.final inthashCode()Returns a hash code value for this object.booleanReturns whether the migration completed successfully.steps()Returns the value of thestepsrecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of thetoVersionrecord component.
-
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 aFailurerecord class.- Parameters:
fromVersion- the value for thefromVersionrecord componenttoVersion- the value for thetoVersionrecord componentsteps- the value for thestepsrecord componentduration- the value for thedurationrecord componentdata- the value for thedatarecord componentcause- the value for thecauserecord component
-
-
Method Details
-
isSuccess
public boolean isSuccess()Description copied from interface:MigrationResultReturns whether the migration completed successfully.- Specified by:
isSuccessin interfaceMigrationResult- Returns:
- true if all migrations were applied successfully
-
error
Description copied from interface:MigrationResultReturns the error if the migration failed.- Specified by:
errorin interfaceMigrationResult- Returns:
- an Optional containing the exception if failed, empty if successful
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
fromVersion
public int fromVersion()Returns the value of thefromVersionrecord component.- Specified by:
fromVersionin interfaceMigrationResult- Returns:
- the value of the
fromVersionrecord component
-
toVersion
public int toVersion()Returns the value of thetoVersionrecord component.- Specified by:
toVersionin interfaceMigrationResult- Returns:
- the value of the
toVersionrecord component
-
steps
Returns the value of thestepsrecord component.- Specified by:
stepsin interfaceMigrationResult- Returns:
- the value of the
stepsrecord component
-
duration
Returns the value of thedurationrecord component.- Specified by:
durationin interfaceMigrationResult- Returns:
- the value of the
durationrecord component
-
data
Returns the value of thedatarecord component.- Specified by:
datain interfaceMigrationResult- Returns:
- the value of the
datarecord component
-
cause
Returns the value of thecauserecord component.- Returns:
- the value of the
causerecord component
-