Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ private static void generateMessageBaseClass(File outputDir, String version, Str
writeSerializationVersion(writer, SERIALIZATION_VERSION);
writeMessageNoArgBaseConstructor(writer, "Message");
writeProtectedMessageBaseConstructor(writer, "Message", getBeginString(version));
writeHeaderMethods(writer);
writeMessageDerivedHeaderClass(writer);

writeEndClassDeclaration(writer);
Expand Down Expand Up @@ -1096,6 +1097,27 @@ private static Writer writeMessageCreateMethod(Writer writer, List<MessageType>
return writer;
}

private static void writeHeaderMethods(FileWriter writer) throws IOException {
writeHeaderFactoryMethod(writer);
writeHeaderGetter(writer);
}

private static void writeHeaderFactoryMethod(FileWriter writer) throws IOException {
writer.write(String.format("%n"));
writer.write(String.format("%s@Override%n", CodeGeneratorUtil.indent(1)));
writer.write(String.format("%sprotected Header newHeader() {%n", CodeGeneratorUtil.indent(1)));
writer.write(String.format("%sreturn new Header(this);%n", CodeGeneratorUtil.indent(2)));
writer.write(String.format("%s}%n", CodeGeneratorUtil.indent(1)));
}

private static void writeHeaderGetter(FileWriter writer) throws IOException {
writer.write(String.format("%n"));
writer.write(String.format("%s@Override%n", CodeGeneratorUtil.indent(1)));
writer.write(String.format("%spublic Header getHeader() {%n", CodeGeneratorUtil.indent(1)));
writer.write(String.format("%sreturn (Message.Header)header;%n", CodeGeneratorUtil.indent(2)));
writer.write(String.format("%s}%n", CodeGeneratorUtil.indent(1)));
}

private static Writer writeMessageDerivedHeaderClass(Writer writer) throws IOException {
writeStaticClassDeclaration(writer, "Header", "quickfix.Message.Header");
writeSerializationVersion(writer, SERIALIZATION_VERSION);
Expand Down
Loading