in src/main/software/amazon/event/ruler/JsonRuleCompiler.java [247:278]
private static void parseIntoOrRelationship(final List<Map<String, List<Patterns>>> rules,
final Path path,
final JsonParser parser,
final boolean withQuotes) throws IOException {
final List<Map<String, List<Patterns>>> currentRules = deepCopyRules(rules);
rules.clear();
JsonToken token = parser.nextToken();
if (token != JsonToken.START_ARRAY) {
barf(parser, "It must be an Array followed with " + Constants.OR_RELATIONSHIP_KEYWORD + ".");
}
int loopCnt = 0;
while ((token = parser.nextToken()) != JsonToken.END_ARRAY) {
loopCnt++;
if (token == JsonToken.START_OBJECT) {
final List<Map<String, List<Patterns>>> newRules = deepCopyRules(currentRules);
if (newRules.isEmpty()) {
newRules.add(new HashMap<>());
}
parseObjectInsideOrRelationship(newRules, path, parser, withQuotes);
rules.addAll(newRules);
} else {
barf(parser,
"Only JSON object is allowed in array of " + Constants.OR_RELATIONSHIP_KEYWORD + " relationship.");
}
}
if (loopCnt < 2) {
barf(parser, "There must have at least 2 Objects in " + Constants.OR_RELATIONSHIP_KEYWORD + " relationship.");
}
}