-
I would like to change a large number of static field names, in this case from enum classes with their usages. Is there a recipe similar to https://docs.openrewrite.org/recipes/java/changemethodname but for that? I can see that OpenRewrite has a visitor implemented, but I cannot find any off the shelf recipe to apply as with the method renamer. If there isn't any hint towards other people's recipes for that usecase would be appreciated |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @kennytv ; Depending on your use case this recipe might be closest to what you're looking for: type: specs.openrewrite.org/v1beta/recipe
name: com.yourorg.ReplaceConstantWithAnotherConstantExample
displayName: Replace constant with another constant example
recipeList:
- org.openrewrite.java.ReplaceConstantWithAnotherConstant:
existingFullyQualifiedConstantName: org.springframework.http.MediaType.APPLICATION_JSON_VALUE
fullyQualifiedConstantName: org.springframework.http.MediaType.APPLICATION_JSON_VALUE There's a few related recipes in the same recipe module that manipulate constants in different ways; might be worth exploring those too to fit your use case there. If this is not what you're looking for it might help to see just one or two concrete examples of what you're looking to achieve, such that we can see what would be needed. |
Beta Was this translation helpful? Give feedback.
Hi @kennytv ; Depending on your use case this recipe might be closest to what you're looking for:
https://docs.openrewrite.org/recipes/java/replaceconstantwithanotherconstant
There's a few related recipes in the same recipe module that manipulate constants in different …