Package space.arim.dazzleconf.migration
Class Migration<C_OLD,C_NEW>
java.lang.Object
space.arim.dazzleconf.migration.Migration<C_OLD,C_NEW>
- Type Parameters:
C_OLD- the old config typeC_NEW- the new config type
A migration package
-
Constructor Summary
ConstructorsConstructorDescriptionMigration(@NonNull MigrateSource<C_OLD> migrateSource, @NonNull Transition<C_OLD, C_NEW> transition) Creates from a source and transition -
Method Summary
Modifier and TypeMethodDescriptionvoidSignals that the migration was fully completed.@NonNull LoadResult<@NonNull C_NEW> tryMigrate(@NonNull MigrateContext migrateContext) Tries to migrate.
-
Constructor Details
-
Migration
public Migration(@NonNull MigrateSource<C_OLD> migrateSource, @NonNull Transition<C_OLD, C_NEW> transition) Creates from a source and transition- Parameters:
migrateSource- the migration sourcetransition- the transition
-
-
Method Details
-
tryMigrate
Tries to migrate.- Parameters:
migrateContext- the migration context- Returns:
- a load result that yields the newly transitioned configuration
-
onCompletion
public void onCompletion()Signals that the migration was fully completed.This means that the old config version may not be necessary to keep around. It might be time to delete, or move to a different place (like config_old.yml) for archival purposes.
- Throws:
UncheckedIOException- upon an I/O failure
-