Interface IConfigMigrationResult


@NonExtendable public interface IConfigMigrationResult
Reports the final outcome of a registered legacy migration.

Inspect this from IConfigMigrator.onMigrationComplete(IConfigMigrationResult) or ISortingConfigMigrator.onMigrationComplete(IConfigMigrationResult) when the mod wants to log a failure, tell the user what was imported, or locate the preserved backup. This also reports outcomes that the migration callback cannot observe itself, such as a skipped migration or a failure after it returns.

Since:
0.3.0
  • Method Details

    • getStatus

      Get the migration outcome.
      Returns:
      migration status
      Since:
      0.3.0
    • getDestinationPath

      Optional<Path> getDestinationPath()
      Get the new MezzConfig file that migration targeted. This is empty when the migration target had no active local destination.
      Returns:
      migration destination, if one was available
      Since:
      0.3.0
    • getLegacyPath

      Optional<Path> getLegacyPath()
      Get the old config file that was selected for import.
      Returns:
      selected normalized absolute legacy path, if one was found
      Since:
      0.3.0
    • getBackupPath

      Optional<Path> getBackupPath()
      Get the preserved legacy-source backup that can be shown to the user or used for recovery. A failed migration may still have a backup when failure happened after backup creation.
      Returns:
      normalized absolute backup path, if a backup was created
      Since:
      0.3.0
    • getImportedValueCount

      int getImportedValueCount()
      Get the number of destination config values imported by this successful migration. Failed and skipped migrations report zero.
      Returns:
      imported destination value count
      Since:
      0.6.0
    • getRejectedValueCount

      int getRejectedValueCount()
      Get the number of legacy values that could not be imported. A migration may still succeed when it imports other usable values.
      Returns:
      rejected legacy value count
      Since:
      0.6.0
    • getDiagnostics

      List<String> getDiagnostics()
      Get bounded diagnostic messages produced while parsing or converting legacy values.
      Returns:
      immutable migration diagnostics in encounter order
      Since:
      0.6.0
    • getFailure

      Optional<Exception> getFailure()
      Get the reason an attempted migration failed.
      Returns:
      migration failure, or empty for non-failure outcomes
      Since:
      0.3.0