从groovy中的对象列表中收集值

时间:2013-02-20 15:37:53

标签: grails groovy gorm

我有这样的方法

static getList (long colorid) {
     ColorShades.findAll 'from ColorShades where color.id = :colorid', [colorid: colorid]
}

我正在使用它:

def shadeIdsForAColor = ColorShades.getList(colorid as long)

问题

该方法返回ArrayListColorShade个对象,每个对象都有shadeId个对象。

如何将这些id作为整数列表放入shadeIdsForAColor变量?

1 个答案:

答案 0 :(得分:0)

这不是吗?

def shadeIdsForAColor = ColorShades.getList(colorid as long).shadeId
相关问题