Package org.openrewrite.config
Class DeclarativeRecipe
java.lang.Object
org.openrewrite.Recipe
org.openrewrite.config.DeclarativeRecipe
- All Implemented Interfaces:
Cloneable
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openrewrite.Recipe
Recipe.Builder, Recipe.DelegatingRecipe -
Field Summary
Fields inherited from class org.openrewrite.Recipe
contributors, examples, PANIC -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPrecondition(Recipe recipe) voidaddUninitialized(String recipeName) voidaddUninitialized(Recipe recipe) voidaddUninitializedPrecondition(String recipeName) voidaddUninitializedPrecondition(Recipe recipe) voidaddValidation(Validated<Object> validated) booleanprotected RecipeDescriptorA list of recipes that run, source file by source file, after this recipe.voidinitialize(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, builder, buildRecipeList, clone, equals, getDataTableDescriptors, getDescription, getDescriptor, getDisplayName, getExamples, getInstanceName, getInstanceNameSuffix, 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:
causesAnotherCyclein 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:
getEstimatedEffortPerOccurrencein 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:RecipeA list of recipes that run, source file by source file, after this recipe. This method is guaranteed to be called only once per cycle.When creating a recipe with a fixed recipe list, either override this method or
Recipe.buildRecipeList(RecipeList)but ideally not both, as their default implementations are interconnected.- Overrides:
getRecipeListin classRecipe- Returns:
- The list of recipes to run.
-
addUninitialized
-
addUninitialized
-
addUninitializedPrecondition
-
addUninitializedPrecondition
-
addValidation
-
validate
Description copied from class:RecipeThe 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:
createRecipeDescriptorin classRecipe
-
getContributors
- Overrides:
getContributorsin classRecipe
-