I'm trying to use lambda expressions with Rythm Engine and it's working in most cases. However, it isn't working when I invoke a tag inside a lambda expression.
Simplest example:
@test(x -> blabla(x) )
@def test(java.util.function.Function f) {
@f.apply("Test")
}
@def blabla(String text) {
...
Test: @text
...
}
If I use string concatenation in the lambda expression, it works perfectly, but in my real code I need to invoke a complex tag.
Does anybody know how I can do it?
Thank you.
Finally, I found a solution.
Revising the generated java code, it can be seen that the function called "blabla" (sorry, stupid name) has the signature:
So, the way to make it work is calling "RawData.toString()".
The solution is:
To prevent unnecessary castings, I add the arguments "String, String" to the generic class "java.util.function.Function".
To test the code, it's useful to define the environment variable "home.tmp.dir" and use a raw CodeType: