Now in the CVS.
Thanks again,
--Keith
Keith Visco wrote:
>
> Eitan,
>
> Thanks a bunch!
>
> I'll get this checked into the CVS. I'll also add a quick comment about
> the create-method is currently limited to containing class.
>
> --Keith
>
> Eitan Suez wrote:
> >
> > i noticed that the "XML/JDO Create Method" section of "tips & tricks" has
> > not yet been written. here is a stab at providing some of that
> > documentation
> > for inclusion in the next release:
> >
> > <section title="XML/JDO: Create method">
> >
> > <p>
> > Castor requires that classes have a public, no-argument constructor in
> > order
> > to provide the ability marshal & unmarshal objects of that type.
> > </p>
> >
> > <p>
> > create-method is an optional attribute to the <field> mapping
> > element that
> > can be used to overcome this restriction in cases where you have an
> > existing
> > object model that constists of, say, singleton classes, where public,
> > no-argument
> > constructors must not be present by definition.
> > </p>
> >
> > <p>
> > Assume for example that a class "A" that you want to be able to
> > unmarshal uses
> > a singleton class as one of its properties. When attempting to
> > unmarshal class
> > "A", you should get an exception, because the singleton property has no
> > public
> > constructor. Assume a reference to the singleton can be obtained via a
> > static
> > getInstance() method, you can add a "create method" to class A like so:
> > </p>
> >
> > <code>
> > <![CDATA[
> > public MySingleton getSingletonProperty()
> > {
> > return MySingleton.getInstance();
> > }
> > ]]>
> > </code>
> >
> > <p>
> > and in the mapping file for class A, you can define the singleton
> > property
> > like so:
> > </p>
> >
> > <code>
> >
> > <![CDATA[
> > <field name="mySingletonProperty"
> > type="com.u2d.MySingleton"
> > create-method="getSingletonProperty">
> > <bind-xml name="my-singleton-property" node="element" />
> > </field>
> > ]]>
> > </code>
> >
> > <p>
> > This illustrates how the create-method attribute is quite a useful
> > mechanism for dealing with exception situations where you might
> > want to take advantage of marshaling even when some classes do not
> > have no-argument public constructors.
> > </p>
> >
> > </section>
> >
> > i have a little bandwidth at the moment. i would like to volunteer to
> > add documentation for aspects of castor that anyone believes is only
> > available on the mailing list archives. feel free to point me to archive
> > messages and i will try to compile documentation on these features.
> >
> > Thanks, Eitan
> >
> > -----------------------------------------------------------
> > 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