CodeGeneratorJ { public void generate(InputStream inputFile, File outputDir) { try { final Repository repository = unmarshal(inputFile); final List<CodeSetType> codeSetList = repository.getCodeSets().getCodeSet(); for (final CodeSetType codeSet : codeSetList) { codeSets.put(codeSet.getName(), codeSet); } final List<FieldType> fieldList = repository.getFields().getField(); final File fileDir = getPackagePath(outputDir, FIELD_PACKAGE); fileDir.mkdirs(); for (final FieldType fieldType : fieldList) { fields.put(fieldType.getId().intValue(), fieldType); generateField(outputDir, fieldType, FIELD_PACKAGE); } String version = repository.getVersion(); final String[] parts = version.split("_"); if (parts.length > 0) { version = parts[0]; } final String versionPath = version.replaceAll("[\\.]", "").toLowerCase(); final String componentPackage = getPackage("quickfix", versionPath, "component"); final File componentDir = getPackagePath(outputDir, componentPackage); componentDir.mkdirs(); final List<ComponentType> componentList = repository.getComponents().getComponent(); for (final ComponentType component : componentList) { components.put(component.getId().intValue(), component); } final List<GroupType> groupList = repository.getGroups().getGroup(); for (final GroupType group : groupList) { groups.put(group.getId().intValue(), group); } for (final GroupType group : groupList) { generateGroup(outputDir, group, componentPackage); } for (final ComponentType component : componentList) { generateComponent(outputDir, component, componentPackage); } final String messagePackage = getPackage("quickfix", versionPath); final File messageDir = getPackagePath(outputDir, messagePackage); messageDir.mkdirs(); final List<MessageType> messageList = repository.getMessages().getMessage(); for (final MessageType message : messageList) { generateMessage(outputDir, message, messagePackage, componentPackage); } generateMessageBaseClass(outputDir, version, messagePackage); generateMessageFactory(outputDir, messagePackage, messageList); generateMessageCracker(outputDir, messagePackage, messageList); } catch (JAXBException | IOException e) { e.printStackTrace(); } }  static void main(String[] args); void generate(InputStream inputFile, File outputDir);  }
@Test public void testGenerate() throws IOException { generator.generate( Thread.currentThread().getContextClassLoader().getResource("mit_compressed.xml").openStream(), new File("target/spec/generated-sources")); }