Package org.axonframework.migration
Class ChangePackageExcludingTypes
java.lang.Object
org.openrewrite.Recipe
org.axonframework.migration.ChangePackageExcludingTypes
- All Implemented Interfaces:
Cloneable
public class ChangePackageExcludingTypes
extends org.openrewrite.Recipe
Moves a package like OpenRewrite's
ChangePackage, but keeps the given types in the old package.
A file referencing nothing of the old package but excluded types is left alone. Any other file is moved by
ChangePackage, after which the excluded types are moved back with ChangeType. Running
ChangePackage and a ChangeType back as two steps of a composite recipe instead moves an excluded type
back and forth in every cycle of a run, so the run never settles.
- Since:
- 5.4.0
- Author:
- Mateusz Nowak
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openrewrite.Recipe
org.openrewrite.Recipe.Builder, org.openrewrite.Recipe.DelegatingRecipe -
Field Summary
Fields inherited from class org.openrewrite.Recipe
contributors, examples, PANIC -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the types of the old package this recipe keeps in it.Returns the package this recipe moves to.Returns the package this recipe moves.@Nullable BooleanReturns whether this recipe moves the subpackages too.org.openrewrite.TreeVisitor<?, org.openrewrite.ExecutionContext> Methods inherited from class org.openrewrite.Recipe
addDataTable, aggregateDataTableDescriptors, builder, buildRecipeList, causesAnotherCycle, clone, createRecipeDescriptor, equals, getContributors, getDataTableDescriptors, getDescriptor, getEstimatedEffortPerOccurrence, getExamples, getInstanceName, getInstanceNameSuffix, getJacksonPolymorphicTypeTag, getMaintainers, getName, getRecipeList, getTags, hashCode, maxCycles, noop, onComplete, run, run, run, setContributors, setExamples, validate, validate, validateAll, validateAll, withOptions
-
Constructor Details
-
ChangePackageExcludingTypes
public ChangePackageExcludingTypes(String oldPackageName, String newPackageName, @Nullable Boolean recursive, @Nullable List<String> excludedTypes) Creates the recipe moving the given package, keeping the given types in it.- Parameters:
oldPackageName- the package to movenewPackageName- the package to move torecursive- whether to move the subpackages too,falsewhennullexcludedTypes- the fully qualified names of the types of the old package that stay in it, none whennull
-
-
Method Details
-
getOldPackageName
Returns the package this recipe moves.- Returns:
- the old package name
-
getNewPackageName
Returns the package this recipe moves to.- Returns:
- the new package name
-
getRecursive
Returns whether this recipe moves the subpackages too.- Returns:
- whether subpackages move, or
nullfor the default of not moving them
-
getExcludedTypes
Returns the types of the old package this recipe keeps in it.- Returns:
- the fully qualified names of the excluded types
-
getDisplayName
- Specified by:
getDisplayNamein classorg.openrewrite.Recipe
-
getDescription
- Specified by:
getDescriptionin classorg.openrewrite.Recipe
-
getVisitor
public org.openrewrite.TreeVisitor<?,org.openrewrite.ExecutionContext> getVisitor()- Overrides:
getVisitorin classorg.openrewrite.Recipe
-