Set<String> (List<ResolvedClassType> objects, String determinantField) { Set<String> result = new TreeSet<>(); for (ResolvedClassType obj : objects) { String value = getConstString(obj.node.get("properties").get(determinantField)); if (value == null) { ruleFactory.getLogger().error("No value for oneAnyOf: " + determinantField); throw new NullPointerException(); } if (!result.add(value)) { ruleFactory.getLogger().error("Duplicated value for oneAnyOf: " + value); throw new IllegalStateException("Duplicated value for oneAnyOf: " + value); } } return result; }