Skip to content

Commit

Permalink
Merge pull request #6 from david-gibbs-ig/utcdateonly-remove-addition…
Browse files Browse the repository at this point in the history
…al-ctor

Removed additional ctor for Fields extendingUtcDateOnlyField, added a…
  • Loading branch information
chrjohn authored Nov 13, 2023
2 parents 1845c43 + 8277132 commit fac2493
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.quickfixj.orchestra</groupId>
<artifactId>parent</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<packaging>pom</packaging>
<name>${project.groupId}:${project.artifactId}</name>
<description>Parent project for FIX Orchestra / QuickFIX integration</description>
Expand Down
2 changes: 1 addition & 1 deletion quickfixj-from-fix-orchestra-repository/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.quickfixj.orchestra</groupId>
<artifactId>parent</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
</parent>

<artifactId>quickfixj-from-fix-orchestra</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.quickfixj.orchestra</groupId>
<artifactId>quickfixj-from-fix-orchestra</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
</parent>

<artifactId>quickfixj-from-fix-orchestra-code-generator-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.quickfixj.orchestra</groupId>
<artifactId>quickfixj-from-fix-orchestra</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
</parent>

<artifactId>quickfixj-from-fix-orchestra-dictionary-generator-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.quickfixj.orchestra</groupId>
<artifactId>quickfixj-from-fix-orchestra</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
</parent>

<artifactId>quickfixj-from-fix-orchestra-generator</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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.%n", file.getName());
e.printStackTrace();
}
}

Expand Down Expand Up @@ -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);
Expand All @@ -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.%n", file.getName());
e.printStackTrace();
}
}

Expand Down Expand Up @@ -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":
Expand All @@ -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";
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit fac2493

Please sign in to comment.