ClassMatcher, FieldMatcher, and MethodMatcher support composite conditions to create complex logical queries. Inside a matcher {} block, regular conditions are implicitly joined with AND.
Supported composite operators:
allOf { ... }: All child conditions must match.anyOf { ... }: At least one child condition must match.noneOf { ... }: All child conditions must not match.not { ... }: Negates a single condition.
Kotlin DSL Example:
val method = bridge.findMethod {
matcher {
declaredClass("org.example.PlayActivity")
anyOf {
match { name = "onCreate" }
match { usingStrings("onClick") }
}
not { usingStrings("rollDice: ") }
}
}
Java Chaining API Example:
If you cannot use Kotlin DSL closures, use the chaining API:
MethodMatcher matcher = MethodMatcher.create()
.declaredClass("org.example.PlayActivity")
.anyOf(
MethodMatcher.create().name("onCreate"),
MethodMatcher.create().usingStrings(List.of("onClick"), StringMatchType.Contains, false)
)
.not(MethodMatcher.create().usingStrings(List.of("rollDice: "), StringMatchType.Contains, false));