private void generateEnumClass(String nodeName,
                                 Schema schema,
                                 List<ResolvedClassType> objects,
                                 String determinantPropertyName,
                                 JDefinedClass superType) {
    Set<String> enumValues = findEnumValuesForOneAnyOf(objects, determinantPropertyName);

    JsonNodeFactory factory = JsonNodeFactory.instance;
    ObjectNode root = factory.objectNode();
    ObjectNode properties = factory.objectNode();
    ObjectNode determinantProperty = factory.objectNode();
    ArrayNode enumValuesArray = factory.arrayNode(enumValues.size());
    root.set("properties", properties);
    root.set("additionalProperties", factory.booleanNode(false));
    properties.set(determinantPropertyName, determinantProperty);
    determinantProperty.set("type", factory.textNode("string"));
    determinantProperty.set("enum", enumValuesArray);
    for (String enumValue : enumValues) {
      enumValuesArray.add(enumValue);
    }
    Schema superTypeSchema = ruleFactory.getSchemaStore().createFakeSchema(
      URI.create("fake://" + superType.fullName() + "$" + determinantPropertyName + ".json"), root);
    ruleFactory.getPropertiesRule().apply(nodeName, properties, root, superType, superTypeSchema);
  }
private void generateEnumClass(String nodeName,
                                 Schema schema,
                                 List<ResolvedClassType> objects,
                                 String determinantPropertyName,
                                 JDefinedClass superType)