如何解决如何在 Mule 4 函数中返回字符串数组?
嗨,我正在从事从 Spring 到 Mule 的迁移项目。
在Java中我们有像
这样的小函数recyclerView
在 Mule 中,我像下面这样写。
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/index/rtree.hpp>
namespace bg = boost::geometry;
namespace bgi = boost::geometry::index;
int main() {
typedef bg::model::point<int,2,bg::cs::cartesian> point;
typedef bg::model::box<point> box;
typedef bg::model::polygon<point,false,false> polygon; // ccw,open polygon
typedef std::pair<point,int> value;
const int M = 4000 * 4000;
const int N = M / 10000;
bgi::rtree< value,bgi::rstar<16,4> > rtree;
for (int in = 0; in < N; in++)
{
point p(rand(),rand());
rtree.insert(value(p,in));
}
for (int im = 0; im < M; im++)
{
point p(rand(),rand());
std::vector<value> vp;
int found = rtree.query(bgi::nearest(p,1),std::back_inserter(vp));
}
}
解决方法
[ "Refinance"," Cash-out"]
只需使用字符串作为函数的最后一个值创建数组文字。我在这种情况下是 if
的真实分支的值。
它在工作室中也应该可以正常工作。可能 if 值的表示方式可能会被抛弃.. 尝试以下操作:
%dw 2.0
output application/json
fun getPurpose(data) =
if(upper("PURCHASE") == data) (["Refinance","Cash-Out"]) else if (1 == 2) "abc" else "nothing"
---
getPurpose("PURCHASE")
输出:
[
"Refinance","Cash-Out"
]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。