← All recipes
Moderne licensed

Chain calls to builder methods

Recipe IDorg.openrewrite.staticanalysis.UseAsBuilder
Artifactorg.openrewrite.recipe:rewrite-static-analysis

Chain calls to builder methods that are on separate lines into one chain of builder calls.

Single recipeMSAL

Usage

You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe org.openrewrite.staticanalysis.UseAsBuilder --recipe-option "builderType=org.example.Buildable.Builder"

If the recipe isn’t available locally, install it with:

mod config recipes jar install org.openrewrite.recipe:rewrite-static-analysis:2.40.0

Options

NameTypeDescription
builderTyperequiredStringFully qualified name of the Builder
e.g. org.example.Buildable.Builder
immutableBooleanThe builder is immutable if you must assign the result of calls to intermediate variables or use directly. Defaults to true as many purpose-built builders will be immutable.
builderCreatorStringThe method that creates the builder instance, which may not be a method of the builder itself.
e.g. org.example.Buildable builder()

Data tables

Structured output this recipe can produce.

  • Source files that had resultsSource files that were modified by the recipe run.org.openrewrite.table.SourcesFileResults
  • Source files that had search resultsSearch results that were found during the recipe run.org.openrewrite.table.SearchResults
  • Source files that errored on a recipeThe details of all errors produced by a recipe run.org.openrewrite.table.SourcesFileErrors
  • Recipe performanceStatistics used in analyzing the performance of recipes.org.openrewrite.table.RecipeRunStats