Class AbstractUpgradeStrategy

java.lang.Object
org.apache.maven.cling.invoker.mvnup.goals.AbstractUpgradeStrategy
All Implemented Interfaces:
UpgradeStrategy
Direct Known Subclasses:
CompatibilityFixStrategy, InferenceStrategy, ModelUpgradeStrategy, PluginUpgradeStrategy

public abstract class AbstractUpgradeStrategy extends Object implements UpgradeStrategy
Abstract base class for upgrade strategies that provides common functionality and reduces code duplication across strategy implementations.
  • Constructor Details

    • AbstractUpgradeStrategy

      public AbstractUpgradeStrategy()
  • Method Details

    • apply

      public final UpgradeResult apply(UpgradeContext context, Map<Path, org.jdom2.Document> pomMap)
      Template method that handles common logging and error handling. Subclasses implement the actual upgrade logic in doApply().
      Specified by:
      apply in interface UpgradeStrategy
      Parameters:
      context - the upgrade context
      pomMap - map of all POM files in the project
      Returns:
      the result of the upgrade operation
    • doApply

      protected abstract UpgradeResult doApply(UpgradeContext context, Map<Path, org.jdom2.Document> pomMap)
      Subclasses implement the actual upgrade logic here.
      Parameters:
      context - the upgrade context
      pomMap - map of all POM files in the project
      Returns:
      the result of the upgrade operation
    • getOptions

      protected final UpgradeOptions getOptions(UpgradeContext context)
      Gets the upgrade options from the context.
      Parameters:
      context - the upgrade context
      Returns:
      the upgrade options
    • logSummary

      protected void logSummary(UpgradeContext context, UpgradeResult result)
      Logs a summary of the upgrade results.
      Parameters:
      context - the upgrade context
      result - the upgrade result