final int parameterCount = parameters.getParameterCount();
if (parameterCount < 1)
{
throw new EvaluationException(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
}
final Type textType = parameters.getType(0);
final Object textValue = parameters.getValue(0);
final String textResult =
context.getTypeRegistry().convertToText(textType, textValue);
if(textResult == null)
{
throw new EvaluationException(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
}
String encodingResult = null;
if(parameterCount == 2)
{
final Type encodingType = parameters.getType(1);
final Object encodingValue = parameters.getValue(1);
encodingResult = context.getTypeRegistry().convertToText(encodingType, encodingValue);
if(encodingResult == null)
{
throw new EvaluationException(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);