return new ExpressionAdapter() {
public Object evaluate(Exchange exchange) {
// evaluate expression as iterator
Iterator<?> it = expression.evaluate(exchange, Iterator.class);
ObjectHelper.notNull(it, "expression: " + expression + " evaluated on " + exchange + " must return an java.util.Iterator");
return new GroupIterator(exchange.getContext(), it, token, group);
}
@Override
public String toString() {
return "group " + expression + " " + group + " times";