Class AbstractUpgradeStrategy
java.lang.Object
org.apache.maven.cling.invoker.mvnup.goals.AbstractUpgradeStrategy
- All Implemented Interfaces:
UpgradeStrategy
- Direct Known Subclasses:
CompatibilityFixStrategy,InferenceStrategy,ModelUpgradeStrategy,PluginUpgradeStrategy
Abstract base class for upgrade strategies that provides common functionality
and reduces code duplication across strategy implementations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal UpgradeResultapply(UpgradeContext context, Map<Path, org.jdom2.Document> pomMap) Template method that handles common logging and error handling.protected abstract UpgradeResultdoApply(UpgradeContext context, Map<Path, org.jdom2.Document> pomMap) Subclasses implement the actual upgrade logic here.protected final UpgradeOptionsgetOptions(UpgradeContext context) Gets the upgrade options from the context.protected voidlogSummary(UpgradeContext context, UpgradeResult result) Logs a summary of the upgrade results.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.maven.cling.invoker.mvnup.goals.UpgradeStrategy
getDescription, isApplicable, isOptionEnabled
-
Constructor Details
-
AbstractUpgradeStrategy
public AbstractUpgradeStrategy()
-
-
Method Details
-
apply
Template method that handles common logging and error handling. Subclasses implement the actual upgrade logic in doApply().- Specified by:
applyin interfaceUpgradeStrategy- Parameters:
context- the upgrade contextpomMap- 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 contextpomMap- map of all POM files in the project- Returns:
- the result of the upgrade operation
-
getOptions
Gets the upgrade options from the context.- Parameters:
context- the upgrade context- Returns:
- the upgrade options
-
logSummary
Logs a summary of the upgrade results.- Parameters:
context- the upgrade contextresult- the upgrade result
-