use of io.fixprotocol.orchestra.model.ModelException 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;
}
Aggregations