Class DeclarativeRecipe

java.lang.Object
org.openrewrite.Recipe
org.openrewrite.config.DeclarativeRecipe
All Implemented Interfaces:
Cloneable

public class DeclarativeRecipe extends Recipe
  • Constructor Details

    • DeclarativeRecipe

      public DeclarativeRecipe()
  • Method Details

    • causesAnotherCycle

      public boolean causesAnotherCycle()
      Overrides:
      causesAnotherCycle in class Recipe
      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

      public void addPrecondition(Recipe recipe)
    • getEstimatedEffortPerOccurrence

      public Duration getEstimatedEffortPerOccurrence()
      Overrides:
      getEstimatedEffortPerOccurrence in class Recipe
      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

      public List<Recipe> 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 class Recipe
      Returns:
      The list of recipes to run.
    • addUninitialized

      public void addUninitialized(Recipe recipe)
    • addUninitialized

      public void addUninitialized(String recipeName)
    • addUninitializedPrecondition

      public void addUninitializedPrecondition(Recipe recipe)
    • addUninitializedPrecondition

      public void addUninitializedPrecondition(String recipeName)
    • addValidation

      public void addValidation(Validated<Object> validated)
    • validate

      public Validated<Object> 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 in NullUtils
      Overrides:
      validate in class Recipe
      Returns:
      A validated instance based using non-null/nullable annotations to determine which fields of the recipe are required.
    • createRecipeDescriptor

      protected RecipeDescriptor createRecipeDescriptor()
      Overrides:
      createRecipeDescriptor in class Recipe
    • getContributors

      public List<Contributor> getContributors()
      Overrides:
      getContributors in class Recipe