
org.fix4j.spec.codegen.StandardTrailerCreator.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fix4j-assert-codegen Show documentation
Show all versions of fix4j-assert-codegen Show documentation
fix4j-assert is a library to assist in testing of applications using FIX protocol
package org.fix4j.spec.codegen
/**
* User: ben
* Date: 26/08/2014
* Time: 5:59 AM
*/
public class StandardTrailerCreator {
protected static writeStandardTrailerJavaFile(final String packageName, final Collection trailerFields) {
def file = new File("StandardTrailer.java")
file.write(createStandardHeaderContent(packageName, trailerFields));
println "Written StandardTrailer.java to:" + file.absolutePath;
}
private static String createStandardHeaderContent(final String packageName, final def fields) {
final StringBuilder sb = new StringBuilder();
sb.append("package ${packageName};\n" +
"\n" +
"import org.fix4j.test.fixspec.BaseFieldAndGroupTypes;\n" +
"import org.fix4j.test.fixspec.BaseGroupType;\n" +
"\n" +
"public class StandardTrailer extends BaseFieldAndGroupTypes {\n" +
" public StandardTrailer(){\n" +
" super(\n");
CompositeContentHelper.buildGroupChildrenForClass(fields, sb, " ");
sb.append(" );\n");
sb.append(" }\n" +
"}");
def str = sb.toString();
return str
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy