Hi Dean,

Thanks for your contributions. We certainly appreciate it and I'm sure
other people will find these additions useful. We'll try and have these
included for the next release.

Thanks,

--Keith

> "Chalker, Dean" wrote:
> 
> Hi Keith, Arnaud et al.,
> 
> Part of my recent work has been to replace DTOs in an application with
> Castor-generated classes.  To do this, I needed to implement the
> following "standard" methods in each generated class, in addition to
> equals():
> 
>    * a full-argument constructor
>    * a copy-constructor
>    * hashCode()
>    * toString() for debug
>    * clone()
> 
> (There is an overlap between usage of the copy-constructor and
> clone()).
> 
> Attached are methods for generating this code which I have inserted
> into org.exolab.castor.builder.SourceFactory.  I hooked into these
> methods from SourceFactory.createSourceCode(XMLBindingComponent,
> SGStateInfo) as follows:
> 
>      //create equals() method?
>      if (component.hasEquals())
>          createEqualsMethod(jClass, component.hasHashcode());
>      //create hashCode() method?
>      if (component.hasHashcode())
>          createHashCodeMethod(jClass, component.hasEquals());
>      if (component.hasToString())
>          createToStringMethod(jClass);
>      if (component.hasClone()) {
>          jClass.addInterface("Cloneable");
>          createCloneMethod(jClass);
>      }
>      if (component.hasFullConstructor())
>          createFullConstructor(jClass);
>      if (component.hasCopyConstructor())
>          createCopyConstructor(jClass);
> 
> 
> 
> I hope you can make use of these.
> 
> 
> 
> Regards
> Dean
> 
> 
> 
> 
> intelli WHERE
> www.intelliwhere.com
> -----------------------------
> Dr. Dean Chalker
> Distinguished Design Engineer
> (R&D)
> [EMAIL PROTECTED]
> 
> IntelliWhere Division,
>  Intergraph Corporation
> Australia
> 
> Phone: 61-7-3510 8918  Fax:
> 61-7-3510 8901
> 
> 
> 
> 
>                        Name: extraMethods.txt
>    extraMethods.txt    Type: Plain Text (text/plain)
>                    Encoding: quoted-printable

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

Reply via email to