Dear Camunda community,
We are experimenting with FEEL plugin to do some extended data validation coming from the users. One of the tasks I have is to provide customised messages containing string templates and parameters in the sames as printf works. As I haven’t found a FEEL analogue for printf - I am trying to use external functions declaration in FEEL to use Java methods for this task (String.format or java.text.MessageFormat). I am able to successfully declare and use simple external functions like cos, sin, etc. in a FEEL context.
However, something like
text_format: function(template,text) external {
java: {
class: “java.lang.String”, method_signature: “format(string, string)”
}
}
throws a “hidden” exception inside context variable
[{"text_message":{"cause":null,"stackTrace":[{"methodName":"unpackVal","fileName":"DefaultValueMapper.scala","lineNumber":84,"className":"org.camunda.feel.interpreter.DefaultValueMapper","nativeMethod":false},{"methodName":"unpackVal","fileName":"CustomValueMapper.scala","lineNumber":13,"className":"org.camunda.feel.spi.CustomValueMapper","nativeMethod":false},{"methodName":"unpackVal","fileName":"CamundaValueMapper.scala","lineNumber":41,"className":"org.camunda.feel.integration.CamundaValueMapper","nativeMethod":false}...
What would be a right way to declare something like String.format() or java.text.MessageFormat.format() in a FEEL context?
P.S. Is there a specific reason why method_signature has an underscore?
Best regards,
Ilya