Interface UpgradeStrategy
- All Known Implementing Classes:
AbstractUpgradeStrategy, CompatibilityFixStrategy, InferenceStrategy, ModelUpgradeStrategy, PluginUpgradeStrategy
public interface UpgradeStrategy
Strategy interface for different types of upgrade operations.
Each strategy handles a specific aspect of the Maven upgrade process.
Strategies work with domtrip Documents for perfect formatting preservation. Individual strategies can create domtrip Editors from Documents as needed:
Editor editor = new Editor(document); // ... perform domtrip operations ... // Document is automatically updated
-
Method Summary
Modifier and TypeMethodDescriptionapply(UpgradeContext context, Map<Path, eu.maveniverse.domtrip.Document> pomMap) Applies the upgrade strategy to all eligible POMs.Gets a description of what this strategy does.booleanisApplicable(UpgradeContext context) Checks if this strategy is applicable given the current options.default booleanisOptionEnabled(UpgradeOptions options, Optional<Boolean> specificOption, boolean defaultWhenNoOptionsSpecified) Helper method to check if a specific option is enabled, considering --all flag and defaults.
-
Method Details
-
apply
Applies the upgrade strategy to all eligible POMs.- Parameters:
context- the upgrade contextpomMap- map of all POM files in the project (domtrip Documents)- Returns:
- the result of the upgrade operation
-
isApplicable
Checks if this strategy is applicable given the current options.- Parameters:
context- the upgrade context- Returns:
- true if this strategy should be applied
-
isOptionEnabled
default boolean isOptionEnabled(UpgradeOptions options, Optional<Boolean> specificOption, boolean defaultWhenNoOptionsSpecified) Helper method to check if a specific option is enabled, considering --all flag and defaults.- Parameters:
options- the upgrade optionsspecificOption- the specific option to checkdefaultWhenNoOptionsSpecified- whether this option should be enabled by default- Returns:
- true if the option should be enabled
-
getDescription
String getDescription()Gets a description of what this strategy does.- Returns:
- a human-readable description of the strategy
-