I updated the Getter and Setter Methods. I realized that I had been
playing, trying to get them to work and had made them unreadable. I also
added some comments to explain what I was doing and what I was expecting.


Thanks for reading this!

I'm trying to UnMarshal a collection of objects that I have successfully
Marshalled. I'm a little confused. In the getter method for the collection,
I traverse the collection, create a vector of objects, and the Marshaller
takes it and puts it into very pretty XML. I expected that the UnMarshaller
would take this very pretty XML and create a vector of objects and call my
setter method so that I could set the reference to this set of objects, or
process them, etc. However, what happens is that my setter method is passed
a vector containing very pretty XML. Am I supposed to call the UnMarshaller
on this Vector? If so, would someone give me some guidance or point me to
some kind of example?

I've listed my getter and setter methods below, as well as the
vector.toString() that is passed to the setter, as well as the line from
the Mapping file that I used.

Thanks in advance for your help!!

<field name="coverages" type="com.csc.fs.life.lifecomm.business.Coverage"
collection="vector"> </field>

public Vector getCoverages()  {
      //method specifically for Castor. Castor's Marshaller calls this
      //method to get a vector of Coverage objects
      Vector coverageVector= new Vector();
      if (coverages == null) {
            return null;
      }
      // Get the Coverage Objects from their current container
      csc.fs.List theCoverages = coverages.getList();
      int coverages_count = theCoverages.size(); // get the size of the
coverages collection

      //create a vector containing Coverage objects
      int count = 0;
      for (int x = 0; x < coverages_count; x++) {
            Coverage n = (Coverage) theCoverages.get(x);
            coverageVector.add(n);
            count++;
      }
      // return vector of coverage objects
      // These objects are marshalled correctly by Castor
      return coverageVector;
}
public void setCoverages(Vector coverageList)  {
      //method specifically for Castor. Castor's UnMarshaller calls this
      //method to when UnMarshalling a vector of Coverage objects

      if (coverageList == null) {
            return;
      }
      coverages = new FSCollection(Coverage.class);
      // How many objects in the Vector from the Unmarshaller?
      int coverages_count = coverageList.size(); // get the size of the
coverages collection

      // Add each object in Vector returned by unMarshaller to
      // Coverages container (FSCollection)
      int count = 0;
      for (int x = 0; x < coverages_count; x++) {
            System.out.println(coverageList.get(x).toString());
//
// SOURCE OF MY CONFUSION
//
            //expected coverageList.get(x) to return a Coverage object.
            // Instead, it's an XML document
            Coverage n = (Coverage) coverageList.get(x);
            coverages.add(n);
            count++;
      }
}

[<?xml version="1.0" encoding="UTF-8"?>
<comp_cd>P00</comp_cd>, <?xml version="1.0" encoding="UTF-8"?>
<pol_no>FB003561LL     </pol_no>, <?xml version="1.0" encoding="UTF-8"?>
<pend_ind>N</pend_ind>, <?xml version="1.0" encoding="UTF-8"?>
<cov_phs>1</cov_phs>, <?xml version="1.0" encoding="UTF-8"?>
<plob_no>20-Traditional</plob_no>, <?xml version="1.0" encoding="UTF-8"?>
<plan_cd_ds>FB020N</plan_cd_ds>, <?xml version="1.0" encoding="UTF-8"?>
<cov_stat>45-Reduced Paid-Up</cov_stat>, <?xml version="1.0"
encoding="UTF-8"?>
<cov_unit>1.884</cov_unit>, <?xml version="1.0" encoding="UTF-8"?>
<cov_value>29.7</cov_value>, <?xml version="1.0" encoding="UTF-8"?>
<face_value>55.95</face_value>, <?xml version="1.0" encoding="UTF-8"?>
<issue_age>26</issue_age>, <?xml version="1.0" encoding="UTF-8"?>
<issue_date>1962-02-15T00:00:00.000-06:00</issue_date>, <?xml version="1.0"
encoding="UTF-8"?>
<maturity_dt>2036-02-15T00:00:00.000-06:00</maturity_dt>, <?xml
version="1.0" encoding="UTF-8"?>
<dbp>A-Cov Face Amt + CV</dbp>, <?xml version="1.0" encoding="UTF-8"?>
<pay_up_dt>2001-08-15T00:00:00.000-05:00</pay_up_dt>, <?xml version="1.0"
encoding="UTF-8"?>
<sex_in>M-Male</sex_in>, <?xml version="1.0" encoding="UTF-8"?>
<lastmaintdt>2004-02-16T19:58:52.000-06:00</lastmaintdt>, <?xml
version="1.0" encoding="UTF-8"?>
<lastmaintusr>NGLoader</lastmaintusr>, <?xml version="1.0"
encoding="UTF-8"?>
<source_sys>LIFECOMM  </source_sys>, <?xml version="1.0" encoding="UTF-8"?>
<ann_prem_per_unit>0.0</ann_prem_per_unit>, <?xml version="1.0"
encoding="UTF-8"?>
<comm_phs_cd>1</comm_phs_cd>, <?xml version="1.0" encoding="UTF-8"?>
<commute_int_rt>0.0</commute_int_rt>, <?xml version="1.0"
encoding="UTF-8"?>
<commute_int_rule>0</commute_int_rule>, <?xml version="1.0"
encoding="UTF-8"?>
<commute_rule/>, <?xml version="1.0" encoding="UTF-8"?>
<cov_class>1-Life</cov_class>, <?xml version="1.0" encoding="UTF-8"?>
<cov_grp_cd>1</cov_grp_cd>, <?xml version="1.0" encoding="UTF-8"?>
<cov_nfo>5-Purchase RPU</cov_nfo>, <?xml version="1.0" encoding="UTF-8"?>
<cov_nfo_adj>1</cov_nfo_adj>, <?xml version="1.0" encoding="UTF-8"?>
<cov_nfo_rule>2</cov_nfo_rule>, <?xml version="1.0" encoding="UTF-8"?>
<cov_sub_phs>0</cov_sub_phs>, <?xml version="1.0" encoding="UTF-8"?>
<div_sel_cd>0</div_sel_cd>, <?xml version="1.0" encoding="UTF-8"?>
<inc_ben_amt>0.0</inc_ben_amt>, <?xml version="1.0" encoding="UTF-8"?>
<inc_ben_level>0</inc_ben_level>, <?xml version="1.0" encoding="UTF-8"?>
<lives_mort_tbl>1</lives_mort_tbl>, <?xml version="1.0" encoding="UTF-8"?>
<nfo_eti_cd>0</nfo_eti_cd>, <?xml version="1.0" encoding="UTF-8"?>
<nfo_rpu_cd>1</nfo_rpu_cd>, <?xml version="1.0" encoding="UTF-8"?>
<orig_mat_dt>2036-02-15T00:00:00.000-06:00</orig_mat_dt>, <?xml
version="1.0" encoding="UTF-8"?>
<par_cd>0</par_cd>, <?xml version="1.0" encoding="UTF-8"?>
<pol_exhibit>C</pol_exhibit>, <?xml version="1.0" encoding="UTF-8"?>
<prod_cont_cd>A</prod_cont_cd>, <?xml version="1.0" encoding="UTF-8"?>
<prod_cont_key>NB</prod_cont_key>, <?xml version="1.0" encoding="UTF-8"?>
<prod_eff_dt>1962-02-15T00:00:00.000-06:00</prod_eff_dt>, <?xml
version="1.0" encoding="UTF-8"?>
<qual_rider_stat/>, <?xml version="1.0" encoding="UTF-8"?>
<rpu_dur>22.18</rpu_dur>, <?xml version="1.0" encoding="UTF-8"?>
<rpu_dur1>22.48</rpu_dur1>, <?xml version="1.0" encoding="UTF-8"?>
<rpu_dur2>22.771758</rpu_dur2>, <?xml version="1.0" encoding="UTF-8"?>
<rpu_lo_dur>42.0</rpu_lo_dur>, <?xml version="1.0" encoding="UTF-8"?>
<rpu_rnd_cd>3</rpu_rnd_cd>, <?xml version="1.0" encoding="UTF-8"?>
<series>APQ01</series>, <?xml version="1.0" encoding="UTF-8"?>
<true_age>26</true_age>, <?xml version="1.0" encoding="UTF-8"?>
<values_use_cd>2</values_use_cd>, <?xml version="1.0" encoding="UTF-8"?>
<nfo_eti_bene>1</nfo_eti_bene>, <?xml version="1.0" encoding="UTF-8"?>
<cov_mrt_cd_pl/>]



-----------------------------------------
Confidentiality Notice: This e-mail communication and any attachments may contain 
confidential and privileged information for the use of the designated recipients named 
above. If you are not the intended recipient, you are hereby notified that you have 
received this communication in error and that any review, disclosure, dissemination, 
distribution or copying of it or its contents is prohibited. If you have received this 
communication in error, please notify me immediately by replying to this message and 
deleting it from your computer. Thank you.

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to