I'm pretty new to Betwixt, so forgive me if this is an unbearably stupid
question:

I have a list of simple beans. Each bean contains a couple of simple
attributes (Strings) and a Collection of Strings:

Public class ReportDef
{
        private String displayName;
        private String reportName;
        private Collection fieldNames;
        public ReportDef(){}
}
(I have the requisite setters and getters, plus a method public void
addFieldName(String field))

I have successfully used betwixt to create my xml document where the top
level element (which is a list) is mapped to the name ReportDefinitions

 <ReportDefinitions> 
    <ReportDef displayName="audit" reportName="Audit">
      <fieldNames>
        <String>Date</String>
        <String>AsAtDate</String>
        <String>NMI</String>
        <String>NMIChecksum</String>
      </fieldNames>
    </ReportDef>
    <ReportDef displayName="a report" reportName="report">
      <fieldNames>
        <String>Date</String>
        <String>AsAtDate</String>
        <String>anotherString</String>
        <String>aFinalString</String>
      </fieldNames>
    </ReportDef>
</ReportDefinitions> 

I try to read it back in,  using the following code:

                BeanReader reader = new BeanReader();

reader.getXMLIntrospector().getConfiguration().setAttributesForPrimitive
s(true);
                reader.getBindingConfiguration().setMapIDs(false);
        
//              Set the custom mappings

reader.registerBeanClass("ReportDefinitions",ArrayList.class);
                reader.registerBeanClass("ReportDef",
com.agl.mdh.report.ReportDef.class);
                reader.registerBeanClass("fieldNames",
Collection.class);
//              reader.getBindingConfiguration().
        
//              Retrieve the list of elements from the config file
                ArrayList list = (ArrayList)reader.parse(in);

The attributes are correctly set, but the fieldNames element is not set,
remaining null.

What am I doing wrong?




**********************************************************************
This email is intended solely for the use of the addressee
and may contain information that is confidential or privileged.
If you receive this email in error please notify the sender and
delete the email immediately.
**********************************************************************

Reply via email to