001 /* 002 @license.text@ 003 */ 004 package biz.hammurapi.eval; 005 006 import java.util.Collection; 007 import java.util.Iterator; 008 009 import biz.hammurapi.convert.CompositeConverter; 010 011 012 public class MultiResult extends Result { 013 Collection values; 014 private CompositeConverter converter; 015 016 /** 017 * @param value 018 * @param type 019 */ 020 public MultiResult(Class type, Collection values, CompositeConverter converter) { 021 super(type); 022 this.values = values; 023 this.converter=converter; 024 } 025 026 public Object[] getValues() { 027 Object[] ret=new Object[values==null ? 0 : values.size()]; 028 if (values!=null) { 029 Iterator it=values.iterator(); 030 for (int i=0; it.hasNext(); i++) { 031 ret[i] = type==null ? it.next() : converter.convert(it.next(), type, false); 032 } 033 } 034 return ret; 035 } 036 037 void setValues(Collection values) { 038 this.values = values; 039 } 040 }