What is the proper type declaration if you are creating a recurring lambda? Say I have the following lambda to create a timer that will count down minutes for me in the UI:
val org.eclipse.xtext.xbase.lib.Functions$Function2 makeAllZonesTimer = [
int myDelay,
org.eclipse.xtext.xbase.lib.Functions$Function2 makeAllZonesTimer2 |
if(myDelay>0) {
allZonesRunTimer = createTimer(now.plusMinutes(1))[|
total_minutes_remaining = (myDelay-1)%3600
total_hours_remaining = (myDelay-1)/3600
postUpdate(all_zones_total_time_remaining, String::format("%1$02d:%2$02d", total_hours_remaining, total_minutes_remaining))
makeAllZonesTimer2.apply(myDelay-1, makeAllZonesTimer2)
]
}
]
As I understand it, the proper syntax for the declaration is function2<paramtype1, paramtype2, resulttype> functionname.
However I can’t seem to find documentation to tell me what type to declare the lambda as. Home Designer (I know it’s buggy anyway, but even openhab runtime logs warn me) warns me that they should be parameterized, yada yada yada. I have tried everything I can think of for what sort of type the result and the second parameter (the passed in lambda) should be: lambda, lambdatype, void, Timer, Function, FunctionType…No luck yet.
Can anyone help me out? I know it still runs and it’s only a warning that I’m getting, not an error, but the perfectionist in me isn’t satisfied. Thanks!