commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wm.A.Stafford" <staff...@marine.rutgers.edu>
Subject DIGESTER - non-pattern based method calls
Date Mon, 26 Jan 2009 21:01:17 GMT
I'm using digester to parse data files and do a db update with the 
data.  I need to associate the db column name and type with each data 
item.  I drive this process with a setup file of the form: pattern 
db_col_name db_col_type

This file is read in and each line is used to create a DataItem object 
with pattern, name and type.  The data will be obtained by digester
public DataItem {
   String pattern;
   String name ;
   String type ;
   String data ;

I loop over a list of DataItems to set up the digester to create an 
ArrayList of DataItems:
digester.addObjectCreate(start_pattern, ArrayList.class);
for ( DataItem d: DataItemList ){
   digester.addObjectCreate(d.getPattern(), DataItem.class); // push a 
DataItem
   digester.addBeanPropertySetter(d.getPattern(), "data"); // call 
DataItem.setData() passing the value matched by the pattern
   digester.addSetNext(d.getPattern(), "add"); // add this DataItem to 
the List
}

What I would like to do is set the name and type attributes of the 
DataItem class that I'm pushing onto the digester stack.  However, all 
setProperty and addCall methods are pattern based and ObjectCreate uses 
the default constructor.

Does digester provide a way to do what I want?

-=beeky




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message