From 535fad5a360b27e2aa6bc034b90024101774ec53 Mon Sep 17 00:00:00 2001 From: David Gibbs Date: Sun, 12 Nov 2023 12:01:45 +0000 Subject: [PATCH 1/2] Removed additional ctor for Fields extendingUtcDateOnlyField, added additional logging to code generation --- pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../quickfixj/orchestra/CodeGeneratorJ.java | 25 ++++++++++++------- 6 files changed, 21 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index 054ca0e..95eefc5 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.quickfixj.orchestra parent - 1.0.1 + 1.0.2 pom ${project.groupId}:${project.artifactId} Parent project for FIX Orchestra / QuickFIX integration diff --git a/quickfixj-from-fix-orchestra-repository/pom.xml b/quickfixj-from-fix-orchestra-repository/pom.xml index ac2b8e4..e008f8b 100644 --- a/quickfixj-from-fix-orchestra-repository/pom.xml +++ b/quickfixj-from-fix-orchestra-repository/pom.xml @@ -5,7 +5,7 @@ org.quickfixj.orchestra parent - 1.0.1 + 1.0.2 quickfixj-from-fix-orchestra diff --git a/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-code-generator-maven-plugin/pom.xml b/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-code-generator-maven-plugin/pom.xml index e04239f..9a77a64 100644 --- a/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-code-generator-maven-plugin/pom.xml +++ b/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-code-generator-maven-plugin/pom.xml @@ -6,7 +6,7 @@ org.quickfixj.orchestra quickfixj-from-fix-orchestra - 1.0.1 + 1.0.2 quickfixj-from-fix-orchestra-code-generator-maven-plugin diff --git a/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-dictionary-generator-maven-plugin/pom.xml b/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-dictionary-generator-maven-plugin/pom.xml index 6163c88..935159d 100644 --- a/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-dictionary-generator-maven-plugin/pom.xml +++ b/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-dictionary-generator-maven-plugin/pom.xml @@ -4,7 +4,7 @@ org.quickfixj.orchestra quickfixj-from-fix-orchestra - 1.0.1 + 1.0.2 quickfixj-from-fix-orchestra-dictionary-generator-maven-plugin diff --git a/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-generator/pom.xml b/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-generator/pom.xml index dbb4350..5b367cf 100644 --- a/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-generator/pom.xml +++ b/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-generator/pom.xml @@ -5,7 +5,7 @@ org.quickfixj.orchestra quickfixj-from-fix-orchestra - 1.0.1 + 1.0.2 quickfixj-from-fix-orchestra-generator diff --git a/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-generator/src/main/java/org/quickfixj/orchestra/CodeGeneratorJ.java b/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-generator/src/main/java/org/quickfixj/orchestra/CodeGeneratorJ.java index ee4d695..f19c289 100644 --- a/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-generator/src/main/java/org/quickfixj/orchestra/CodeGeneratorJ.java +++ b/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-generator/src/main/java/org/quickfixj/orchestra/CodeGeneratorJ.java @@ -78,8 +78,8 @@ public class CodeGeneratorJ { public static final int GRP_MSG_TYPE_GRP = 2098; private static final int FAIL_STATUS = 1; - private static final String DOUBLE_FIELD = "DoubleField"; - private static final String DECIMAL_FIELD = "DecimalField"; + public static final String DOUBLE_FIELD = "DoubleField"; + public static final String DECIMAL_FIELD = "DecimalField"; private static final String FIXT_1_1 = "FIXT.1.1"; @@ -91,7 +91,9 @@ public class CodeGeneratorJ { private static final String FIELD_PACKAGE = "quickfix.field"; private static final long SERIALIZATION_VERSION = 552892318L; - + public static final String UTC_DATE_ONLY = "UTCDateOnly"; + public static final String UTC_DATE_ONLY_FIELD = "UtcDateOnlyField"; + private boolean isGenerateBigDecimal = true; private boolean isGenerateOnlySession = false; private boolean isExcludeSession = false; @@ -430,6 +432,7 @@ private static void generateField(File outputDir, String decimalTypeString) throws IOException { final String name = toTitleCase(fieldType.getName()); final File file = getClassFilePath(outputDir, packageName, name); + System.out.printf("Generating Field file : %s.%n", file.getName()); try (FileWriter writer = new FileWriter(file)) { writeFileHeader(writer); writePackage(writer, packageName); @@ -459,6 +462,9 @@ private static void generateField(File outputDir, writeFieldNoArgConstructor(writer, name, fieldId); writeFieldArgConstructor(writer, name, fieldId, baseClassname, isGenerateBigDecimal); writeEndClassDeclaration(writer); + } catch (Exception e) { + System.err.printf("Exception generating file : %s", file.getName()); + e.printStackTrace(); } } @@ -519,6 +525,7 @@ private static void generateMessage(File outputDir, messageClassname = messageClassname + toTitleCase(scenario); } final File file = getClassFilePath(outputDir, messagePackage, messageClassname); + System.out.printf("Generating Message file : %s.%n", file.getName()); try (FileWriter writer = new FileWriter(file)) { writeFileHeader(writer); writePackage(writer, messagePackage); @@ -540,6 +547,9 @@ private static void generateMessage(File outputDir, writeMemberAccessors(writer, members, messagePackage, componentPackage, groups, components, fields); writeEndClassDeclaration(writer); + } catch (Exception e) { + System.err.printf("Exception generating file : %s", file.getName()); + e.printStackTrace(); } } @@ -671,7 +681,7 @@ private static File getClassFilePath(File outputDir, String packageName, String return new File(outputDir, sb.toString()); } - private static String getFieldBaseClass(String type, String decimalTypeString) { + public static String getFieldBaseClass(String type, String decimalTypeString) { String baseType; switch (type) { case "char": @@ -698,8 +708,8 @@ private static String getFieldBaseClass(String type, String decimalTypeString) { case "UTCTimeOnly": baseType = "UtcTimeOnlyField"; break; - case "UTCDateOnly": - baseType = "UtcDateOnlyField"; + case UTC_DATE_ONLY: + baseType = UTC_DATE_ONLY_FIELD; break; case "Boolean": baseType = "BooleanField"; @@ -855,9 +865,6 @@ private static Writer writeFieldArgConstructor(Writer writer, case "UtcDateOnlyField": writer.write(String.format("%n%spublic %s(LocalDate data) {%n%ssuper(%d, data);%n%s}%n", CodeGeneratorUtil.indent(1), className, CodeGeneratorUtil.indent(2), fieldId, CodeGeneratorUtil.indent(1))); - // added for compatibility with existing QFJ tests - writer.write(String.format("%n%spublic %s(String data) {%n%ssuper(%d, data);%n%s}%n", CodeGeneratorUtil.indent(1), className, - CodeGeneratorUtil.indent(2), fieldId, CodeGeneratorUtil.indent(1))); break; case "UtcTimeOnlyField": writer.write(String.format("%n%spublic %s(LocalTime data) {%n%ssuper(%d, data);%n%s}%n", CodeGeneratorUtil.indent(1), From 82771324309764f081a491d832c5949d83be37e1 Mon Sep 17 00:00:00 2001 From: David Gibbs Date: Sun, 12 Nov 2023 12:24:18 +0000 Subject: [PATCH 2/2] Added newline to new error messages --- .../src/main/java/org/quickfixj/orchestra/CodeGeneratorJ.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-generator/src/main/java/org/quickfixj/orchestra/CodeGeneratorJ.java b/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-generator/src/main/java/org/quickfixj/orchestra/CodeGeneratorJ.java index f19c289..2f58473 100644 --- a/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-generator/src/main/java/org/quickfixj/orchestra/CodeGeneratorJ.java +++ b/quickfixj-from-fix-orchestra-repository/quickfixj-from-fix-orchestra-generator/src/main/java/org/quickfixj/orchestra/CodeGeneratorJ.java @@ -463,7 +463,7 @@ private static void generateField(File outputDir, writeFieldArgConstructor(writer, name, fieldId, baseClassname, isGenerateBigDecimal); writeEndClassDeclaration(writer); } catch (Exception e) { - System.err.printf("Exception generating file : %s", file.getName()); + System.err.printf("Exception generating file : %s.%n", file.getName()); e.printStackTrace(); } } @@ -548,7 +548,7 @@ private static void generateMessage(File outputDir, writeEndClassDeclaration(writer); } catch (Exception e) { - System.err.printf("Exception generating file : %s", file.getName()); + System.err.printf("Exception generating file : %s.%n", file.getName()); e.printStackTrace(); } }