Class SourceSpec<T extends org.openrewrite.SourceFile>

java.lang.Object
org.openrewrite.test.SourceSpec<T>
All Implemented Interfaces:
Iterable<SourceSpec<?>>, SourceSpecs

public class SourceSpec<T extends org.openrewrite.SourceFile> extends Object implements SourceSpecs
  • Field Details

    • dir

      protected Path dir
    • sourcePath

      protected @Nullable Path sourcePath
    • markers

      protected org.openrewrite.marker.Markers markers
    • beforeRecipe

      protected ThrowingUnaryOperator<T extends org.openrewrite.SourceFile> beforeRecipe
    • afterRecipe

      protected org.openrewrite.internal.ThrowingConsumer<T extends org.openrewrite.SourceFile> afterRecipe
    • skip

      protected boolean skip
    • noTrim

      protected boolean noTrim
  • Constructor Details

    • SourceSpec

      public SourceSpec(Class<T> sourceFileType, @Nullable String dsl, org.openrewrite.Parser.Builder parser, @Nullable String before, @Nullable UnaryOperator<String> after)
  • Method Details

    • getMarkers

      public List<org.openrewrite.marker.Marker> getMarkers()
    • path

      public SourceSpec<T> path(Path sourcePath)
      Parameters:
      sourcePath - The source path before the recipe is run.
      Returns:
      This source spec.
    • path

      public SourceSpec<T> path(String sourcePath)
      Parameters:
      sourcePath - The source path before the recipe is run.
      Returns:
      This source spec.
    • markers

      public SourceSpec<T> markers(org.openrewrite.marker.Marker... markers)
    • after

      public SourceSpec<T> after(UnaryOperator<String> after)
      Apply a function to specify what the after text of a recipe run should be.
      Parameters:
      after - A unary operator that takes the actual result and returns the expected result. The actual result can be used to pull out things that are dynamic, like timestamps or dependency versions that may change between runs.
      Returns:
      This source spec.
    • mapBeforeRecipe

      public SourceSpec<T> mapBeforeRecipe(ThrowingUnaryOperator<T> beforeRecipe)
    • beforeRecipe

      public SourceSpec<T> beforeRecipe(org.openrewrite.internal.ThrowingConsumer<T> beforeRecipe)
    • afterRecipe

      public SourceSpec<T> afterRecipe(org.openrewrite.internal.ThrowingConsumer<T> afterRecipe)
    • skip

      public SourceSpec<T> skip()
    • skip

      public SourceSpec<T> skip(@Nullable Boolean skip)
    • noTrim

      public SourceSpec<T> noTrim()
    • noTrim

      public SourceSpec<T> noTrim(@Nullable Boolean noTrim)
    • iterator

      public Iterator<SourceSpec<?>> iterator()
      Specified by:
      iterator in interface Iterable<T extends org.openrewrite.SourceFile>