Idiomatic way to remove/search/change if it has a certain value #4524
Answered
by
timtebeek
crankydillo
asked this question in
Q&A
-
I need to remove/change a property only if it has a certain value. I think writing an imperative recipe for this won't be that bad, but just making sure there is no current standard way on this. Everything I see in properties just searches by key. Example |
Beta Was this translation helpful? Give feedback.
Answered by
timtebeek
Sep 26, 2024
Replies: 1 comment 4 replies
-
You could add a precondition using org.openrewrite.properties.ChangePropertyValue, to match the old value and change it to something else.. Only if that produces any changes would the recipeList containing your removal be executed. Hope that's clear and helps! |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
timtebeek
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could add a precondition using org.openrewrite.properties.ChangePropertyValue, to match the old value and change it to something else.. Only if that produces any changes would the recipeList containing your removal be executed. Hope that's clear and helps!