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 type
C_NEW - the new config type

public final class Migration<C_OLD,C_NEW> extends Object
A migration package
  • 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 source
      transition - the transition
  • Method Details

    • tryMigrate

      public @NonNull LoadResult<@NonNull C_NEW> tryMigrate(@NonNull MigrateContext migrateContext)
      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