Class MigrationPlan

java.lang.Object
com.patbaumgartner.spring.migrator.core.MigrationPlan

public final class MigrationPlan extends Object
The outcome of analysing a project: every deprecated property that was found, why the migrator classified it the way it did, and the exact file content that would be written if the plan is applied.

Analysis and mutation are separate on purpose. Callers can inspect a plan, decide to fail the build, and never touch a single file, which avoids the trap of rewriting some files and then aborting because of a finding elsewhere.

  • Method Details

    • changes

      public List<MigrationChange> changes()
      Returns every finding, in file and line order.
      Returns:
      all changes
    • changes

      public List<MigrationChange> changes(Outcome outcome)
      Returns the findings with a given outcome.
      Parameters:
      outcome - the outcome to filter by
      Returns:
      the matching changes
    • diagnostics

      public List<String> diagnostics()
      Returns messages about conditions that make the result less trustworthy, such as unreadable files or an empty metadata repository.
      Returns:
      the diagnostics
    • deprecations

      public List<MigrationChange> deprecations()
      Returns every deprecation finding, excluding keys that are merely absent from the metadata.

      Failure policies are expressed in terms of deprecations only, so an advisory unrecognised key must never make a build fail that was configured to fail on deprecations.

      Returns:
      the changes whose outcome states something the metadata proved
    • hasFindings

      public boolean hasFindings()
      Returns whether any deprecated property was found.
      Returns:
      whether the plan has findings
    • hasPendingWrites

      public boolean hasPendingWrites()
      Returns whether applying the plan would modify any file.
      Returns:
      whether there is anything to write
    • render

      public String render(boolean applied)
      Renders a human-readable report.
      Parameters:
      applied - whether the plan has been written to disk
      Returns:
      the report text