I like to schedule observations of variable duration (planning entity) into hourly time slots over several nights. I would need to impose that there are no gaps in particular groups, and need collectors for minimum, maximum and sum. Is there a workaround to have a groupBy
with one groupKeyMapping and three collectors?
constraintFactory.from(OB.class)
.groupBy(OB::getGroupID, min(OB::getStart), max(OB::getEnd), sum(OB::getDuration))
I tried to workaround this using toList()
and computing values myself but strangely it doesn't pass down a List<OB>
but single OB
s. The code below prints class my.package.OB
constraintFactory.from(OB.class)
.groupBy(OB::getGroupID, toList())
.filter((groupID, entries) -> {
println "=> ${entries.class} "
return true
})
question from:
https://stackoverflow.com/questions/65928663/groupby-with-3-constraintcollectors 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…