Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/103.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Mule中设置会话变量的数据类型?_Mule_Session Variables_Mule Studio_Mule Component - Fatal编程技术网

如何在Mule中设置会话变量的数据类型?

如何在Mule中设置会话变量的数据类型?,mule,session-variables,mule-studio,mule-component,Mule,Session Variables,Mule Studio,Mule Component,我需要将会话变量的数据类型声明为整数,但无法执行此操作。当我尝试将会话变量声明为123时,分配的数据类型是string。当我尝试使用MEL[123]时,分配的数据类型是double 试试这个: #[new java.lang.Integer("123")] 您需要将其显式定义为整数。尝试以下方法: #[new java.lang.Integer("123")] 您需要将其显式定义为整数。不确定[123]为什么是双精度的,因为它应该默认为整数。[123.0]默认为双倍。但是,[new java

我需要将会话变量的数据类型声明为整数,但无法执行此操作。当我尝试将会话变量声明为123时,分配的数据类型是string。当我尝试使用MEL[123]时,分配的数据类型是double

试试这个:

#[new java.lang.Integer("123")]
您需要将其显式定义为整数。

尝试以下方法:

#[new java.lang.Integer("123")]

您需要将其显式定义为整数。

不确定[123]为什么是双精度的,因为它应该默认为整数。[123.0]默认为双倍。但是,[new java.lang.Integer123]也可以工作。

不确定为什么[123]是双精度的,因为它应该默认为整数。[123.0]默认为双倍。但是,[new java.lang.Integer123]也可以工作。

您可以获取字符串值并将其转换为整数

#[Integer.parseInt(sessionVars.myInteger)]

您可以获取字符串值并将其转换为整数

#[Integer.parseInt(sessionVars.myInteger)]

将值123设置为变量,并使用以下表达式转换值:


[Integer.parseIntsessionVars.myInteger]将值123设置为变量,并使用以下表达式转换值:


[Integer.parseIntsessionVars.myInteger]我使用以下方法获取整数值:

<set-session-variable variableName="testVar" value="#[23456]" doc:name="Session Variable"/>

这里我得到的是整数:-

我使用以下方法获取整数值:

<set-session-variable variableName="testVar" value="#[23456]" doc:name="Session Variable"/>

这里我得到的是整数:-

如果我使用上述参数,则数据类型定义为字符串。如果我使用上述参数,则数据类型定义为字符串。