1 28 package net.sf.jasperreports.engine.data; 29 30 import net.sf.jasperreports.engine.JRException; 31 import net.sf.jasperreports.engine.JRField; 32 33 34 38 public class JRBeanArrayDataSource extends JRAbstractBeanDataSource 39 { 40 41 42 45 private Object [] data = null; 46 private int index = -1; 47 48 49 52 public JRBeanArrayDataSource(Object [] beanArray) 53 { 54 this(beanArray, true); 55 } 56 57 58 61 public JRBeanArrayDataSource(Object [] beanArray, boolean isUseFieldDescription) 62 { 63 super(isUseFieldDescription); 64 65 this.data = beanArray; 66 } 67 68 69 72 public boolean next() 73 { 74 this.index++; 75 76 if (this.data != null) 77 { 78 return (this.index < this.data.length); 79 } 80 81 return false; 82 } 83 84 85 88 public Object getFieldValue(JRField field) throws JRException 89 { 90 return getFieldValue(data[this.index], field); 91 } 92 93 94 97 public void moveFirst() 98 { 99 this.index = -1; 100 } 101 102 103 } 104 | Popular Tags |