Class PolyglotRecipe
- java.lang.Object
-
- org.openrewrite.Recipe
-
- org.openrewrite.polyglot.PolyglotRecipe
-
public class PolyglotRecipe extends Recipe
-
-
Constructor Summary
Constructors Constructor Description PolyglotRecipe(java.lang.String name, org.graalvm.polyglot.Value value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected @Nullable TreeVisitor<?,ExecutionContext>getApplicableTest()A recipe can optionally include an applicability test that can be used to determine whether it should run on a set of source files (or even be listed in a suggested list of recipes for a particular codebase).java.util.List<CategoryDescriptor>getCategoryDescriptors()java.lang.StringgetDescription()A human-readable description for the recipe, consisting of one or more full sentences ending with a period.java.lang.StringgetDisplayName()A human-readable display name for the recipe, initial capped with no period.java.lang.StringgetName()java.util.List<NamedStyles>getNamedStyles()RecipeDescriptorgetRecipeDescriptor()protected @Nullable TreeVisitor<?,ExecutionContext>getSingleSourceApplicableTest()A recipe can optionally include an applicability test that can be used to determine whether it should run on a particular source file.java.util.Set<java.lang.String>getTags()A set of strings used for categorizing related recipes.protected TreeVisitor<?,ExecutionContext>getVisitor()A recipe can optionally encasulate a visitor that performs operations on a set of source files.java.lang.StringtoString()-
Methods inherited from class org.openrewrite.Recipe
causesAnotherCycle, doNext, equals, getDescriptor, getEstimatedEffortPerOccurrence, getJacksonPolymorphicTypeTag, getLanguages, getRecipeList, hashCode, noop, run, run, run, run, validate, validate, validateAll, validateAll, visit
-
-
-
-
Method Detail
-
getRecipeDescriptor
public RecipeDescriptor getRecipeDescriptor()
-
getCategoryDescriptors
public java.util.List<CategoryDescriptor> getCategoryDescriptors()
-
getNamedStyles
public java.util.List<NamedStyles> getNamedStyles()
-
getDisplayName
public java.lang.String getDisplayName()
Description copied from class:RecipeA human-readable display name for the recipe, initial capped with no period. For example, "Find text". The display name can be assumed to be rendered in documentation and other places where markdown is understood, so it is possible to use stylistic markers like backticks to indicate types. For example, "Find uses of `java.util.List`".- Specified by:
getDisplayNamein classRecipe- Returns:
- The display name.
-
getDescription
public java.lang.String getDescription()
Description copied from class:RecipeA human-readable description for the recipe, consisting of one or more full sentences ending with a period."Find methods by pattern." is an example. The description can be assumed to be rendered in documentation and other places where markdown is understood, so it is possible to use stylistic markers like backticks to indicate types. For example, "Find uses of `java.util.List`.".
- Overrides:
getDescriptionin classRecipe- Returns:
- The display name.
-
getTags
public java.util.Set<java.lang.String> getTags()
Description copied from class:RecipeA set of strings used for categorizing related recipes. For example "testing", "junit", "spring". Tags should not include information about the language(s) this recipe is applicable to. SeeRecipe.getLanguages()instead. Any individual tag should consist of a single word, all lowercase.
-
getApplicableTest
@Nullable protected @Nullable TreeVisitor<?,ExecutionContext> getApplicableTest()
Description copied from class:RecipeA recipe can optionally include an applicability test that can be used to determine whether it should run on a set of source files (or even be listed in a suggested list of recipes for a particular codebase).To identify a tree as applicable, the visitor should mark or otherwise any tree at any level. Any mutation that the applicability test visitor makes to a tree will not included in the results.
- Overrides:
getApplicableTestin classRecipe- Returns:
- A tree visitor that performs an applicability test.
-
getSingleSourceApplicableTest
@Nullable protected @Nullable TreeVisitor<?,ExecutionContext> getSingleSourceApplicableTest()
Description copied from class:RecipeA recipe can optionally include an applicability test that can be used to determine whether it should run on a particular source file.To identify a
SourceFileas applicable, the visitor should mark it at any level. Any mutation that the applicability test visitor makes on the tree will not included in the results.The applicability test only affects whether this recipes
Recipe.getVisitor()will run. DownstreamRecipe.doNext(Recipe)will still run.- Overrides:
getSingleSourceApplicableTestin classRecipe- Returns:
- A tree visitor that performs an applicability test.
-
getVisitor
protected TreeVisitor<?,ExecutionContext> getVisitor()
Description copied from class:RecipeA recipe can optionally encasulate a visitor that performs operations on a set of source files. Subclasses of the recipe may override this method to provide an instance of a visitor that will be used when the recipe is executed.- Overrides:
getVisitorin classRecipe- Returns:
- A tree visitor that will perform operations associated with the recipe.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-