Update of /cvsroot/openamf/openamf/src/java/org/openamf/filter
In directory sc8-pr-cvs1:/tmp/cvs-serv14598/src/java/org/openamf/filter
Modified Files:
BeanListToRecordSet.java
Log Message:
added support for Iterators
Index: BeanListToRecordSet.java
===================================================================
RCS file: /cvsroot/openamf/openamf/src/java/org/openamf/filter/BeanListToRecordSet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** BeanListToRecordSet.java 5 May 2003 00:55:37 -0000 1.2
--- BeanListToRecordSet.java 6 Jun 2003 01:11:04 -0000 1.3
***************
*** 1,4 ****
--- 1,6 ----
package org.openamf.filter;
+ import java.util.ArrayList;
+ import java.util.Iterator;
import java.util.List;
***************
*** 19,34 ****
ASRecordSet recordSet = null;
if (value instanceof List) {
! String[] ignoreProperties = config.getParameterValues("ignore");
! recordSet = new ASRecordSet();
! try {
! recordSet.populate((List)value, ignoreProperties);
! } catch (Exception e) {
! throw new FilterException(e);
}
} else {
! throw new FilterException("value is not an instance of List");
}
return recordSet;
}
--- 21,50 ----
ASRecordSet recordSet = null;
if (value instanceof List) {
! recordSet = processList(value, config);
! } else if (value instanceof Iterator) {
! Iterator iterator = (Iterator)value;
! ArrayList list = new ArrayList();
! while (iterator.hasNext()) {
! list.add(iterator.next());
}
+ recordSet = processList(list, config);
} else {
! throw new FilterException("value is not an instance of List or Iterator");
}
return recordSet;
+ }
+
+ private ASRecordSet processList(Object value, FilterConfig config)
+ throws FilterException {
+ ASRecordSet recordSet;
+ String[] ignoreProperties = config.getParameterValues("ignore");
+ recordSet = new ASRecordSet();
+ try {
+ recordSet.populate((List)value, ignoreProperties);
+ } catch (Exception e) {
+ throw new FilterException(e);
+ }
+ return recordSet;
}
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.