Class AppendToTextFile

java.lang.Object
org.openrewrite.Recipe
org.openrewrite.text.AppendToTextFile
All Implemented Interfaces:
Cloneable

public class AppendToTextFile extends Recipe
  • Constructor Details

    • AppendToTextFile

      public AppendToTextFile()
  • Method Details

    • getDisplayName

      public String getDisplayName()
      Description copied from class: Recipe
      A 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:
      getDisplayName in class Recipe
      Returns:
      The display name.
    • getDescription

      public String getDescription()
      Description copied from class: Recipe
      A 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:
      getDescription in class Recipe
      Returns:
      The display name.
    • visit

      protected List<SourceFile> visit(List<SourceFile> before, ExecutionContext ctx)
      Description copied from class: Recipe
      Override this to generate new source files or delete source files. Note that here, as throughout OpenRewrite, we use referential equality to detect that a change has occured. To indicate to rewrite that the recipe has made changes a different instance must be returned than the instance passed in as "before".

      Currently, the list passed in as "before" is not immutable, but you should treat it as such anyway.

      Overrides:
      visit in class Recipe
      Parameters:
      before - The set of source files to operate on.
      ctx - The current execution context.
      Returns:
      A set of source files, with some files potentially added/deleted/modified.