Files
gh-openrewrite-rewrite-docs…/skills/writing-openrewrite-recipes/references/recipes-java-basic.csv
2025-11-30 08:45:33 +08:00

5.4 KiB

1Fully Qualified Recipe NameRecipe NameDescription
2org.openrewrite.java.AddCommentToImportAdd comment to import statementAdd a comment to an import statement in a Java source file.
3org.openrewrite.java.AddCommentToMethodAdd comment to method declarationsAdd a comment to method declarations in a Java source file.
4org.openrewrite.java.AddCommentToMethodInvocationsAdd comment to method invocationsAdd a comment to method invocations in a Java source file.
5org.openrewrite.java.AddMethodParameterAdd method parameter to a method declarationAdds a new method parameter to an existing method declaration.
6org.openrewrite.java.ChangeMethodAccessLevelChange method access levelChange the access level (public protected private package private) of a method.
7org.openrewrite.java.ChangeMethodInvocationReturnTypeChange method invocation return typeChanges the return type of a method invocation.
8org.openrewrite.java.ChangeMethodNameChange method nameRename a method.
9org.openrewrite.java.ChangeMethodTargetToStaticChange method target to staticChange method invocations to static method calls.
10org.openrewrite.java.ChangeMethodTargetToVariableChange method target to variableChange method invocations to method calls on a variable.
11org.openrewrite.java.ChangePackageRename package nameA recipe that will rename a package name in package statements imports and fully-qualified types.
12org.openrewrite.java.ChangePackageInStringLiteralRename package name in String literalsA recipe that will rename a package name in String literals.
13org.openrewrite.java.ChangeTypeChange typeChange a given type to another.
14org.openrewrite.java.ChangeTypeInStringLiteralChange type in String literalsChange a given type to another when used in a String literal.
15org.openrewrite.java.DeleteMethodArgumentDelete method argumentDelete an argument from method invocations.
16org.openrewrite.java.RemoveAnnotationRemove annotationRemove matching annotations wherever they occur.
17org.openrewrite.java.RemoveAnnotationAttributeRemove annotation attributeSome annotations accept arguments. This recipe removes an existing attribute.
18org.openrewrite.java.ReplaceAnnotationReplace annotationReplace an Annotation with another one if the annotation pattern matches. Only fixed parameters can be set in the replacement.
19org.openrewrite.java.ReplaceConstantReplace constant with literal valueReplace a named constant with a literal value when you wish to remove the old constant. A `String` literal must include escaped quotes.
20org.openrewrite.java.ReplaceConstantWithAnotherConstantReplace constant with another constantReplace a constant with another constant adding/removing import on class if needed.
21org.openrewrite.java.ReplaceStringLiteralValueReplace `String` literalReplace the value of a complete `String` literal.
22org.openrewrite.java.ReplaceStringLiteralWithConstantReplace String literal with constantReplace String literal with constant adding import on class if needed.
23org.openrewrite.java.ShortenFullyQualifiedTypeReferencesAdd imports for fully qualified references to typesAny fully qualified references to Java types will be replaced with corresponding simple names and import statements provided that it doesn't result in any conflicts with other imports or types declared in the local compilation unit.
24org.openrewrite.maven.AddAnnotationProcessorAdd an annotation processor to `maven-compiler-plugin`Add an annotation processor to the maven compiler plugin. Will not do anything if it already exists. Also doesn't add anything when no other annotation processors are defined yet. (Perhaps `ChangePluginConfiguration` can be used).
25org.openrewrite.python.ChangeMethodNameChange method nameRenames a method.
26org.openrewrite.java.micronaut.RemoveAnnotationProcessorPathRemove Maven annotation processor pathRemove the Maven annotation processor path that matches the given groupId and artifactId.
27org.openrewrite.java.micronaut.AddAnnotationProcessorPathAdd Maven annotation processor pathAdd the groupId artifactId version and exclusions of a Maven annotation processor path.
28org.openrewrite.java.migrate.ReplaceStringLiteralValueReplace `String` literalReplace the value of a complete `String` literal.
29org.openrewrite.java.spring.http.ReplaceStringLiteralsWithHttpHeadersConstantsReplace String literals with `HttpHeaders` constantsReplace String literals with `org.springframework.http.HttpHeaders` constants.
30org.openrewrite.java.spring.http.ReplaceStringLiteralsWithMediaTypeConstantsReplace String literals with `MediaType` constantsReplace String literals with `org.springframework.http.MediaType` constants.
31org.openrewrite.java.spring.boot3.ReplaceStringLiteralsWithConstantsReplace String literals with Spring constantsReplace String literals with Spring constants where applicable.
32org.apache.camel.upgrade.camel40.ChangeTypesMigrate moved types between Camel 3.x and Camel 4.xChange type of classes related to change of API.
33org.apache.camel.upgrade.camel49.DebeziumChangeTypesEach camel-debezium module has its own subpackage corresponding to the database typeeach camel-debezium module has its own subpackage corresponding to the database type. So for example all the classes of the module camel-debezium-postgres have been moved to a dedicated package which is org.apache.camel.component.debezium.postgres instead of having everything under the root package org.apache.camel.component.debezium.