Tom-

Okay, deleting my previous reply because I was completely off track...
 Short version is the MappingTool is based on the Castor Introspector
which looks for methods that start with "get" or "set" and assumes
what follows is a field that should be written to the XML.  So your
method getOutput(int index) makes Castor think there is a field
"output" that should be written to the XML.  Since the contents of
your ArrayList are already being mapped using an earlier field element
(outputList), you can safely remove the field element for output from
the mapping file.

As for documentation, there's probably not as much as we would like,
but the mapping file itself is described here:

   http://castor.codehaus.org/xml-mapping.html

HTH,
Stephen


On 3/2/06, Thomas A Hurley <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have the following class which I've fed into the MappingTool to generate a
> mapping file. When I attempt to marshal an instance of the java object the
> exception
>
> org.exolab.castor.mapping.MappingException: The method getOutput in class
> castortest.gamma.OneWayOutputPage accepting/returning object of type
> interface java.util.Enumeration was not found
>
> is thrown. I don't understand where the 'output' property is coming from
> though it kind of makes sense when I look at the mapping file. Should I just
> add a method enumerating the contents of the ArrayList?
>
> I would be grateful if anyone could direct me to some good castor resources
> with examples on the web as I hate to be bothering you guys so often with
> such basic questions.
>
> Thanks in advance.
>
> Tom.
>
> ===========
> Java Object
> ===========
> public class OneWayOutputPage {
>
>   private ArrayList<OneWayOutput> outputList = new
> ArrayList<OneWayOutput>();
>
>   /**
>    * Creates a new instance of OneWayOutputPage
>    */
>   public OneWayOutputPage() {}
>
>   public void setOutputList(ArrayList<OneWayOutput> outputList) {
>     this.outputList = outputList;
>   }
>   public ArrayList<OneWayOutput> getOutputList() {
>     return outputList;
>   }
>
>   public void addOutput(OneWayOutput oneWayOutput) {
>     outputList.add(oneWayOutput);
>   }
>   public OneWayOutput getOutput(int index) {
>     return outputList.get(index);
>   }
> }
>
> ============
> Mapping File
> ============
> <?xml version="1.0" encoding="UTF-8"?>
> <mapping xmlns="http://castor.exolab.org/";
> xmlns:cst="http://castor.exolab.org/";>
>     <description>Castor generated mapping file</description>
>     <class cst:name="castortest.gamma.OneWayOutputPage">
>         <description>Default mapping for class
> castortest.gamma.OneWayOutputPage</description>
>         <map-to cst:xml="one-way-output-page"/>
>         <field cst:name="outputList" cst:type="java.lang.Object"
> cst:collection="arraylist">
>             <bind-xml name="output-list" node="element"/>
>         </field>
>         <field cst:name="output"
>             cst:type="castortest.gamma.OneWayOutput"
> cst:collection="enumerate">
>             <bind-xml name="output" node="element"/>
>         </field>
>     </class>
>     <class cst:name="castortest.gamma.OneWayOutput">
>         <description>Default mapping for class
> castortest.gamma.OneWayOutput</description>
>         <map-to cst:xml="one-way-output"/>
>         <field cst:name="columnTotal" cst:type="int">
>             <bind-xml name="column-total" node="attribute"/>
>         </field>
>         <field cst:name="twoWay" cst:type="boolean">
>             <bind-xml name="two-way" node="attribute"/>
>         </field>
>         <field cst:name="oneWay" cst:type="boolean">
>             <bind-xml name="one-way" node="attribute"/>
>         </field>
>         <field cst:name="rows" cst:type="castortest.gamma.ResponseRow"
> cst:collection="array">
>             <bind-xml name="rows" node="element"/>
>         </field>
>         <field cst:name="questionText" cst:type="java.lang.String">
>             <bind-xml name="question-text" node="element"/>
>         </field>
>     </class>
>     <class cst:name="castortest.gamma.ResponseRow">
>         <description>Default mapping for class
> castortest.gamma.ResponseRow</description>
>         <map-to cst:xml="response-row"/>
>         <field cst:name="count" cst:type="int">
>             <bind-xml name="count" node="attribute"/>
>         </field>
>         <field cst:name="response" cst:type="java.lang.String">
>             <bind-xml name="response" node="element"/>
>         </field>
>         <field cst:name="width" cst:type="java.lang.String">
>             <bind-xml name="width" node="element"/>
>         </field>
>         <field cst:name="percent" cst:type="java.lang.String">
>             <bind-xml name="percent" node="element"/>
>         </field>
>     </class>
> </mapping>
>
> AnaBus Analytic Business Services, Inc.
> With better information, we helpyou makebetterdecisions.
>  Thomas A. Hurley
>  (215) 576-8447 ext.104
>  (215) 576-8452 fax
>  [EMAIL PROTECTED]
>
>
>
> -------------------------------------------------
> If you wish to unsubscribe from this list, please
> send an empty message to the following address:
>
> [EMAIL PROTECTED]
> -------------------------------------------------
>
>

Reply via email to