Package space.arim.dazzleconf.migration
Interface MigrateContext
- All Superinterfaces:
UpdateListener
Contextual resources to be used by migrations.
This interface is implemented by the caller when passed to migrations.
-
Method Summary
Modifier and TypeMethodDescription@NonNull ErrorContext.SourceA factory allowing migrations to produce errors.@NonNull BackendThe backend being used to load the main configuration.voidnotifyUpdate(@NonNull KeyPath entryPath, @NonNull UpdateReason updateReason) Allows migrations to signal updated paths.
-
Method Details
-
mainBackend
@NonNull Backend mainBackend()The backend being used to load the main configuration.This will not necessarily be used by all migrations. Some migrations, for example, may source from a separate file, or combine different backends to get the data they need.
- Returns:
- the main backend being used to load the configuraion
-
notifyUpdate
Allows migrations to signal updated paths.Migrations may optionally use this method to identify which parts of a configuration (if applicable) were changed during the course of migration.
- Specified by:
notifyUpdatein interfaceUpdateListener- Parameters:
entryPath- the path of the entryupdateReason- the update reason, note that some implementors will discard this parameter in favor ofUpdateReason.MIGRATEDeven if a different value is passed
-
errorSource
@NonNull ErrorContext.Source errorSource()A factory allowing migrations to produce errors.Unlike other parts of the API, the error source is provided as a getter, and not as an extended interface. This reflects the want to make implementing
MigrateContextconvenient, if library users wish to call migrations using their own approach.- Returns:
- a factory for error production
-