use of io.fixprotocol._2020.orchestra.repository.CodeType in project fix-orchestra by FIXTradingCommunity.
the class CodeSetScope method resolve.
/*
* (non-Javadoc)
*
* @see
* io.fixprotocol.orchestra.dsl.antlr.Scope#resolve(io.fixprotocol.orchestra.dsl.antlr.PathStep)
*/
@SuppressWarnings("unchecked")
@Override
public FixValue<?> resolve(PathStep pathStep) {
final String dataTypeString = codeSet.getType();
final FixType dataType = FixType.forName(dataTypeString);
final String name = pathStep.getName();
final List<CodeType> codes = codeSet.getCode();
for (final CodeType code : codes) {
if (code.getName().equals(name)) {
@SuppressWarnings("rawtypes") FixValue fixValue;
try {
fixValue = FixValueFactory.create(name, dataType, dataType.getValueClass());
fixValue.setValue(dataType.getValueClass().cast(dataType.fromString(code.getValue())));
return fixValue;
} catch (final ModelException e) {
return null;
}
}
}
return null;
}
use of io.fixprotocol._2020.orchestra.repository.CodeType in project fix-orchestra by FIXTradingCommunity.
the class DocGenerator method generateCodeSetDetail.
private void generateCodeSetDetail(final Path datatypesOutputPath, final CodeSetType codeSet) throws Exception {
final Path path = datatypesOutputPath.resolve(String.format("%s-%s.html", codeSet.getName(), codeSet.getScenario()));
try (final STWriterWrapper writer = getWriter(path)) {
final ST stCodesetStart = stGroup.getInstanceOf("codeSetStart");
stCodesetStart.add("codeSet", codeSet);
stCodesetStart.write(writer, templateErrorListener);
final List<CodeType> codeList = codeSet.getCode();
for (final CodeType code : codeList) {
final ST stCode = stGroup.getInstanceOf("code");
stCode.add("code", code);
stCode.add("supported", supportedMap.get(code.getSupported()));
stCode.write(writer, templateErrorListener);
}
final ST stCodesetEnd = stGroup.getInstanceOf("codeSetEnd");
stCodesetEnd.add("codeSet", codeSet);
stCodesetEnd.write(writer, templateErrorListener);
}
}