The problem with changing the method names is backward compatability.

We can introduce some new method names, but the old ones will have to
remain around for a while so as to not break already generated code and
projects that intergrate Castor.

It's very difficult to change the API of a class that is used frequently
such as the Marshaller and Unmarshaller without causing problems to most
of the people using them.

--Keith

Heiko Erhardt wrote:
> 
> > Renaming the methods is definitely not on the to-do list right now but
> > as you said many users fall into this pitfall. I would remind that the
> > user is responsible to check the documentation of an API before/while
> > using it.
> 
> Sure he is. However, choosing the same for static and object-related
> methods leads to confusion easily. Well, this is also some kind of
> Java issue. I can't consider it a good design making static methods
> accessible by using an instance object instead of the class name. :(
> Java also has its disadvantages...
> 
> Heiko Erhardt
> skynamics AG
> www.skynamics.com
> 
> > -----Original Message-----
> > From: Arnaud Blandin [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, June 07, 2002 2:08 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [castor-dev] help: unable to find FieldDescriptor for...
> >
> >
> > Hi Heiko,
> >
> > Renaming the methods is definitely not on the to-do list right now but
> > as you said many users fall into this pitfall. I would remind that the
> > user is responsible to check the documentation of an API before/while
> > using it.
> > Anyway we'll try to think about a solution.
> >
> > Arnaud
> >
> > > -----Original Message-----
> > > From: Heiko Erhardt [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, June 07, 2002 12:08 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: [castor-dev] help: unable to find FieldDescriptor for...
> > >
> > > >   dnas = (DASDNA)unmar.unmarshal(DASDNA.class, inReader);
> > > wasn't working because you invoked the static unmarshal method,
> > > which won't consider any mapping files you added to unmar by calling
> > > unmar.setMapping. This approach will use the default 'magic' in
> > > Castor's mapping framework, which is based upon introspection of
> > > the classes.
> > > This seems to be a common cause of trouble, many people stumbled
> > > into this pitfall (so did I ;)
> > > Keith, what do you think about renaming the static unmarshal method
> > > to something like unmarshalDefault to prevent this confusion?
> > >
> > > Reading the mapping from a location different from the class file's
> > > shouldn't be a problem.
> > >
> > > Mapping mapping = new Mapping (getClass ().getClassLoader ());
> > > URL url = new URL ("file:/...");
> > > mapping.loadMapping (url);
> > > unmar.setMapping (mapping);
> > >
> > > will load the mapping from the specified url. See the java.net.URL
> > class for
> > > details.
> > >
> > > HTH,
> > >
> > > Heiko Erhardt
> > > skynamics AG
> > > www.skynamics.com
> > >
> > > > -----Original Message-----
> > > > From: michael.l.stoppelman.1 [mailto:[EMAIL PROTECTED]]
> > > > Sent: Friday, June 07, 2002 5:44 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Re: [castor-dev] help: unable to find FieldDescriptor
> > for...
> > > >
> > > >
> > > > That might be another problem, but I got it to work with that
> > mapping...
> > > > The problem was that the class files for the xml parser needed to be
> > in
> > > > the same directory as the class that made the mapping... It wasn't
> > working
> > > > because of this line:
> > > >
> > > >   dnas = (DASDNA)unmar.unmarshal(DASDNA.class, inReader);
> > > >
> > > > That line was causing the error, when you remove the DASDNA.class
> > > >
> > > >   dnas = (DASDNA)unmar.unmarshal(inReader);
> > > >
> > > > Magic. it works. Anyways, is there a way to tell the xml sax parser
> > where
> > > > you other class files are so I can have the mapper in a different
> > > > directory than my classes that are used for the mapping.
> > > >
> > > > Thanks again!
> > > > Mike
> > > >
> > > > On Thu, 6 Jun 2002, Keith Visco wrote:
> > > >
> > > > >
> > > > > Your mapping file is incorrect...tracing through the mapping you
> > can see
> > > > > the problem.
> > > > >
> > > > > The root element <DASDNA> will most likely get mapped to the
> > DASDNA
> > > > > class. The first child of <DASDNA> is a <SEQUENCE> element.
> > However your
> > > > > mapping for DASDNA class only contains one field, which is also
> > mapped
> > > > > to an element name of <DASDNA>. So there is no <SEQUENCE> binding
> > inside
> > > > > class DASDNA.
> > > > >
> > > > > The following change should work:
> > > > >
> > > > >      <class name="edu.mit.wi.omnigene.omnidas.DASDNA">
> > > > >          <field name="DNAs" type="edu.mit.wi.omnigene.omnidas.DNA"
> > > > > collection="vector">
> > > > >              <bind-xml name="SEQUENCE"/>
> > > > >          </field>
> > > > >       </class>
> > > > >
> > > > > notice the bind-xml name has been changed from DASDNA to SEQUENCE.
> > > > >
> > > > > --Keith
> > > > >
> > > > >
> > > > >
> > > > > "michael.l.stoppelman.1" wrote:
> > > > > >
> > > > > > I am trying to convert xml to an object and I have run into a
> > problem,
> > > > > > this is with the castor.properties debug set to true:
> > > > > >
> > > > > > unable to find FieldDescriptor for 'SEQUENCE' in ClassDescriptor
> > of
> > > DASDNA
> > > > > > Ignoring DNA no descriptor was found
> > > > > > Ignoring SEQUENCE no descriptor was found
> > > > > >
> > > > > > My mapping is the following:
> > > > > >
> > > > > > <?xml version="1.0"?>
> > > > > > <!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version
> > 1.0//EN"
> > > > > >     "http://castor.exolab.org/mapping.dtd";>
> > > > > > <mapping>
> > > > > >     <class name="edu.mit.wi.omnigene.omnidas.DASDNA">
> > > > > >
> > > > > >         <field name="DNAs"
> > type="edu.mit.wi.omnigene.omnidas.DNA"
> > > > > > collection="vector">
> > > > > >             <bind-xml name="DASDNA"/>
> > > > > >         </field>
> > > > > >
> > > > > >     </class>
> > > > > >
> > > > > >     <class name="edu.mit.wi.omnigene.omnidas.DNA">
> > > > > >         <map-to xml="SEQUENCE"/>
> > > > > >
> > > > > >         <!--<field name="Range"
> > > > > > type="edu.mit.wi.omnigene.omnidas.RangeImpl">
> > > > > >         </field> -->
> > > > > >
> > > > > >         <field name="ID" type="java.lang.String">
> > > > > >             <bind-xml name="id" node="attribute"/>
> > > > > >         </field>
> > > > > >
> > > > > >         <field name="Length" type="long">
> > > > > >             <bind-xml name="length" node="attribute"/>
> > > > > >         </field>
> > > > > >
> > > > > >         <field name="SequenceValue" type="java.lang.String" >
> > > > > >             <bind-xml name="DNA" node="element"/>
> > > > > >         </field>
> > > > > >     </class>
> > > > > >
> > > > > > <!--
> > > > > >     <class name="edu.mit.wi.omnigene.omnidas.RangeImpl"
> > > > > > auto-complete="true">
> > > > > >         <map-to xml="SEQUENCE" />
> > > > > >         <field name="StartPosition" type="long">
> > > > > >             <bind-xml name="start" node="attribute"/>
> > > > > >         </field>
> > > > > >
> > > > > >         <field name="EndPosition" type="long">
> > > > > >             <bind-xml name="stop" node="attribute"/>
> > > > > >         </field>
> > > > > >     </class>
> > > > > > -->
> > > > > >
> > > > > > </mapping>
> > > > > >
> > > > > > XML FILE:
> > > > > > <?xml version="1.0" standalone="no"?>
> > > > > >      <!DOCTYPE DASDNA SYSTEM
> > "http://www.biodas.org/dtd/dasdna.dtd";>
> > > > > >      <DASDNA>
> > > > > >        <SEQUENCE id="1" start="1" stop="100" version="1.00">
> > > > > >          <DNA length="100">
> > > > > >
> > atttcttggcgtaaataagagtctcaatgagactctcagaagaaaattgataaatattat
> > > > > >
> > taatgatataataataatcttgttgatccgttctatctccagacgattttcctagtctcc
> > > > > >
> > agtcgattttgcgctgaaaatgggatatttaatggaattgtttttgtttttattaataaa
> > > > > >
> > taggaataaatttacgaaaatcacaaaattttcaataaaaaacaccaaaaaaaagagaaa
> > > > > >
> > aaatgagaaaaatcgacgaaaatcggtataaaatcaaataaaaatagaaggaaaatattc
> > > > > >
> > agctcgtaaacccacacgtgcggcacggtttcgtgggcggggcgtctctgccgggaaaat
> > > > > >
> > tttgcgtttaaaaactcacatataggcatccaatggattttcggattttaaaaattaata
> > > > > >
> > taaaatcagggaaatttttttaaattttttcacatcgatattcggtatcaggggcaaaat
> > > > > >
> > tagagtcagaaacatatatttccccacaaactctactccccctttaaacaaagcaaagag
> > > > > >
> > cgatactcattgcctgtagcctctatattatgccttatgggaatgcatttgattgtttcc
> > > > > >
> > gcatattgtttacaaccatttatacaacatgtgacgtagacgcactgggcggttgtaaaa
> > > > > >
> > cctgacagaaagaattggtcccgtcatctactttctgattttttggaaaatatgtacaat
> > > > > >
> > gtcgtccagtattctattccttctcggcgatttggccaagttattcaaacacgtataaat
> > > > > >
> > aaaaatcaataaagctaggaaaatattttcagccatcacaaagtttcgtcagccttgtta
> > > > > >
> > tgtcaaccactttttatacaaattatataaccagaaatactattaaataagtatttgtat
> > > > > >
> > gaaacaatgaacactattataacattttcagaaaatgtagtatttaagcgaaggtagtgc
> > > > > >            acatcaaggccgtcaaacggaaaaatttttgcaagaatca
> > > > > >          </DNA>
> > > > > >        </SEQUENCE>
> > > > > >      </DASDNA>
> > > > > >
> > > > > > I have been working at this for about two days :). Any ideas
> > would
> > > > > > possibly help save my sanity.
> > > > > >
> > > > > > Thanks in advance,
> > > > > > Mike
> > > > > >
> > > > > > -----------------------------------------------------------
> > > > > > If you wish to unsubscribe from this mailing, send mail to
> > > > > > [EMAIL PROTECTED] with a subject of:
> > > > > >         unsubscribe castor-dev
> > > > >
> > > > > -----------------------------------------------------------
> > > > > If you wish to unsubscribe from this mailing, send mail to
> > > > > [EMAIL PROTECTED] with a subject of:
> > > > >         unsubscribe castor-dev
> > > > >
> > > > >
> > > >
> > > > -----------------------------------------------------------
> > > > If you wish to unsubscribe from this mailing, send mail to
> > > > [EMAIL PROTECTED] with a subject of:
> > > >   unsubscribe castor-dev
> > > >
> > >
> > > -----------------------------------------------------------
> > > If you wish to unsubscribe from this mailing, send mail to
> > > [EMAIL PROTECTED] with a subject of:
> > >     unsubscribe castor-dev
> >
> > -----------------------------------------------------------
> > If you wish to unsubscribe from this mailing, send mail to
> > [EMAIL PROTECTED] with a subject of:
> >       unsubscribe castor-dev
> >
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

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

Reply via email to