Package org.openrewrite.config
Class DeclarativeRecipe
java.lang.Object
org.openrewrite.Recipe
org.openrewrite.config.DeclarativeRecipe
- All Implemented Interfaces:
Cloneable
-
Field Summary
Fields inherited from class org.openrewrite.Recipe
contributors, examples, PANIC
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPrecondition
(Recipe recipe) void
addUninitialized
(String recipeName) void
addUninitialized
(Recipe recipe) void
addUninitializedPrecondition
(String recipeName) void
addUninitializedPrecondition
(Recipe recipe) void
addValidation
(Validated<Object> validated) boolean
protected RecipeDescriptor
A list of recipes that run, source file by source file, after this recipe.void
initialize
(Collection<Recipe> availableRecipes, Map<String, List<Contributor>> recipeToContributors) validate()
The default implementation of validate on the recipe will look for package and field level annotations that indicate a field is not-null.Methods inherited from class org.openrewrite.Recipe
addDataTable, clone, equals, getDataTableDescriptors, getDescription, getDescriptor, getDisplayName, getExamples, getJacksonPolymorphicTypeTag, getMaintainers, getName, getTags, getVisitor, hashCode, maxCycles, noop, run, run, run, validate, validateAll, validateAll
-
Constructor Details
-
DeclarativeRecipe
public DeclarativeRecipe()
-
-
Method Details
-
causesAnotherCycle
public boolean causesAnotherCycle()- Overrides:
causesAnotherCycle
in classRecipe
- Returns:
- Determines if another cycle is run when this recipe makes a change. In some cases, like changing method declaration names, a further cycle is needed to update method invocations of that declaration that were visited prior to the declaration change. But other visitors never need to cause another cycle, such as those that format whitespace or add search markers. Note that even when this is false, the recipe will still run on another cycle if any other recipe causes another cycle to run. But if every recipe reports no need to run another cycle (or if there are no changes made in a cycle), then another will not run.
-
addPrecondition
-
getEstimatedEffortPerOccurrence
- Overrides:
getEstimatedEffortPerOccurrence
in classRecipe
- Returns:
- An estimated effort were a developer to fix manually instead of using this recipe.
-
initialize
public void initialize(Collection<Recipe> availableRecipes, Map<String, List<Contributor>> recipeToContributors) -
getRecipeList
Description copied from class:Recipe
A list of recipes that run, source file by source file, after this recipe. This method is guaranteed to be called only once per cycle.- Overrides:
getRecipeList
in classRecipe
- Returns:
- The list of recipes to run.
-
addUninitialized
-
addUninitialized
-
addUninitializedPrecondition
-
addUninitializedPrecondition
-
addValidation
-
validate
Description copied from class:Recipe
The default implementation of validate on the recipe will look for package and field level annotations that indicate a field is not-null. The annotations must have run-time retention and the simple name of the annotation must match one of the common names defined inNullUtils
-
createRecipeDescriptor
- Overrides:
createRecipeDescriptor
in classRecipe
-
getContributors
- Overrides:
getContributors
in classRecipe
-