Simplify a call chain

Apache 2.0

Simplify a.b().c() to a.d().

org.openrewrite.java.SimplifyMethodChain

Required

A list of method patterns that are called in sequence Separate values with commas.

The method name that will replace the existing name. The new method name target is assumed to have the same arguments as the last method in the chain.

Optional

matchOverridesBoolean

When enabled, find methods that are overrides of the method pattern.

mod run . --recipe=org.openrewrite.java.SimplifyMethodChain \ -P methodPatternChain='['\''java.util.Map keySet()'\'', '\''java.util.Set contains(..)'\'']' \ -P newMethodName=containsKey

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.