public void generate(Model model) { for (Type type : model.getTypes()) { if (type instanceof EnumType) { EnumType enumType = (EnumType) type; generateEnum(enumType); } } }
private void writeSchema() { // Header: writer.writeStartElement(XS_URI, "schema"); writer.writeAttribute("version", "1.0"); // Generate the action types: writeActionTypes(); // Find the struct and enum types: List<StructType> structTypes = new ArrayList<>(); List<EnumType> enumTypes = new ArrayList<>(); for (Type type : model.getTypes()) { if (type instanceof StructType && type != identifiedType) { structTypes.add((StructType) type); } if (type instanceof EnumType) { enumTypes.add((EnumType) type); } } // Write the XML schema group of elements that are used by the capabilities resource to list the possible // values of the enum types. Eventually the complete capabilities elements will be generated, but for now // it is written manually and int includes this group. writeEnumValues(enumTypes); // Write the XML schema for the enum types: enumTypes.forEach(this::writeEnumType); // Write the XML schema for the struct types: structTypes.forEach(this::writeStructType); // Footer: writer.writeEndElement(); }