[SOLVED] Type conversion

Hey guys,

just started to do a bit Xtend again and fell into the first pit right after the second step. How do declare a “function” with a pre-declared return type?
My Code
val org.eclipse.xtext.xbase.lib.Functions$Function1 calculateTimeOut = [
Integer lightValue
|

//just an example
return 5
] 

I want to call it like that to retrieve an value (at best as primitve int value

val int timeoutValue = calculateTimeOut.apply(illumination_sensor_aussendachmastlicht.state)

What I get is an cannot convert Object to int …

Can anyone help me here ?

How to make such an expression type safe ?

Hi again,

never mind … found it :frowning:

val int timeoutValue = calculateTimeOut.apply(illumination_sensor_aussendachmastlicht.state) as Integer

Sorry for bothering you guys :slight_smile: