in common/src/main/java/org/apache/rocketmq/eventbridge/tools/pattern/PatternCondition.java [43:74]
public boolean match(JsonElement jsonData) {
if (jsonData == null) {
// Only ExistsCondition instance accept a null data
return this instanceof ExistsCondition && this.matchPrimitive(null);
}
if (!check(jsonData)) {
return false;
}
if (jsonData.isJsonPrimitive()) {
return matchPrimitive(jsonData.getAsJsonPrimitive());
}
if (jsonData.isJsonNull()) {
return matchNull(jsonData.getAsJsonNull());
}
// If the value in the event is an array, then the pattern matches if the intersection of the pattern array
// and the event array is non-empty.
for (final JsonElement element : jsonData.getAsJsonArray()) {
if (element.isJsonPrimitive() && matchPrimitive(element.getAsJsonPrimitive())) {
return true;
}
if (element.isJsonNull() && matchNull(element.getAsJsonNull())) {
return true;
}
}
return false;
}