Chain calls to builder methods
Recipe ID
org.openrewrite.staticanalysis.UseAsBuilderArtifact
org.openrewrite.recipe:rewrite-static-analysisChain calls to builder methods that are on separate lines into one chain of builder calls.
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.0Options
| Name | Type | Description |
|---|---|---|
builderTyperequired | String | Fully qualified name of the Builder e.g. org.example.Buildable.Builder |
immutable | Boolean | The 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. |
builderCreator | String | The 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