use of org.activityinfo.model.formula.diagnostic.ArgumentException in project activityinfo by bedatadriven.
the class IfFunction method resolveResultType.
@Override
public FieldType resolveResultType(List<FieldType> argumentTypes) {
checkArity(argumentTypes, 3);
FieldType conditionType = argumentTypes.get(0);
if (!(conditionType instanceof BooleanType)) {
throw new ArgumentException(0, "Expected TRUE/FALSE value");
}
FieldType trueType = argumentTypes.get(1);
FieldType falseType = argumentTypes.get(2);
if (trueType.getTypeClass() != falseType.getTypeClass()) {
throw new ArgumentException(2, "Must have the same type as the TRUE argument.");
}
return trueType;
}
Aggregations