Package net.mezzdev.config.api.migration
Interface ISortingConfigMigrator<T>
- Type Parameters:
T- sortable value type
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Imports a saved order from the format a mod used before adopting a MezzConfig sorting config.
Register a migrator with ISortingConfig.setLegacyMigration(java.util.List<java.nio.file.Path>, net.mezzdev.config.api.migration.ISortingConfigMigrator<T>). Parse the old file in migrate(java.nio.file.Path, net.mezzdev.config.api.migration.ISortingConfigMigrationContext<T>) and pass the
converted order to the supplied context. MezzConfig handles backup, validation, and writing its current sorting format.
- Since:
- 0.3.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidmigrate(Path legacyPath, ISortingConfigMigrationContext<T> context) Import the order from the selected legacy file.default voidReceive the final migration outcome for logging, diagnostics, or user-facing feedback.
-
Method Details
-
migrate
Import the order from the selected legacy file.- Parameters:
legacyPath- normalized absolute path to the selected legacy filecontext- context for supplying the converted saved order- Throws:
Exception- if the legacy file cannot be read or migrated- Since:
- 0.3.0
-
onMigrationComplete
Receive the final migration outcome for logging, diagnostics, or user-facing feedback.Override this when the mod needs to handle skipped migrations or failures that happen after
migrate(java.nio.file.Path, net.mezzdev.config.api.migration.ISortingConfigMigrationContext<T>)returns. Lambdas may ignore it. An exception from this method is logged and does not change the completed outcome.- Parameters:
result- final structured migration result- Since:
- 0.3.0
-