JExpression (JCodeModel model, String... jsonTypes) { List<String> tokenKinds = new ArrayList<>(); for (String jsonType : jsonTypes) { tokenKinds.addAll(tokenTypeMap.get(jsonType)); } JExpression condition = null; for (String token : tokenKinds) { JExpression tokenCondition = JExpr.ref("token").eq(model.ref(JsonToken.class).staticRef(token)); if (condition == null) { condition = tokenCondition; } else { condition = condition.cor(tokenCondition); } } return condition; }