James
----- Original Message -----
From: "Jason van Zyl" <[EMAIL PROTECTED]>
To: "Jakarta Commons Developers List" <[EMAIL PROTECTED]>
Sent: Sunday, March 10, 2002 3:13 AM
Subject: [betwixt] Default Behaviour


> Hi James,
>
> I'm just looking over the maven project descriptor in the tests and I
> was thinking again about a 'standard' format for XML files and was
> wondering if you had any opinions?
>
> Using all lower case:
>
> <project>
> ...
> </project>
>
> Where the root element matches to a Project class.
>
> And something like:
>
> <short-description>Project Management Tool</short-description>
>
> and having that map to the setShortDescription(String) property.
>
> Or having the XML elements have Java variable looking names like:
>
> <Project>
> ...
> </Project>
>
> and
>
> <shortDescription>...</shortDescription>
>
> I honestly prefer the lower case with hypens but I'm not all that fussy.

I kinda prefer the latter with mixedCase starting with lower case but thats
just me. Though I guess the Betwixt component should allow pluggable default
naming schemes using a Strategy pattern.


> I will use the default behavior of betwixt to map everything that I've
> used my little mapper for so that all things Turbine will eventually use
> the a common format so that mapping will be consistent, error free and
> easy.
>
> Also how are nested objects created? Are they expected to be in the same
> package as the parent class?

No. Betwixt uses Java Bean introspection to figure things out so it
shouldn't matter. (Though this does mean that types need to be registered
with the BeanReader for it to figure out what to parse).


> So if I have:
>
> <project>
>   <mailing-lists>
>     <mailing-list>
>       <name/>
>       <description/>
>       <subscribe/>
>       <unsubscribe/>
>       <archive/>
>     </mailing-list>
>   </mailing-lists>
> </project>
>
> Is the MailingList class expected to be in the same package as Project
> class?

No it should work whatever the package.

> Also would you mind if something like the following was added as default
> behaviour:
>
> <pipeline>
>   <valve className="o.a.t.valve.Valve1"/>
>   <valve className="o.a.t.valve.Valve2"/>
> </pipeline>
>
> Where the className attribute would be used to instantiate the desired
> object?

I guess this is a bit like Robert's ID generation stuff. We should add it as
a feature / strategy and allow folks to turn it on or off by default or on a
class-by-class basis.


> In the little mapper I made I used attributes as mapping information and
> the elements as bean data. Maybe you are doing the same but I'm just
> getting familiar with betwixt but I love it so far it's exactly what
> I've been wanting I just didn't know it :-)

:-) thats great to hear!

I'd hope betwixt could be flexible enough to do it easily. e.g. ID & IDREF
generation is kinda mapping information. I'm sure there could/should be
others - like class names to use etc. So long as this kinda stuff is
pluggable/configurable then we should all be happy. It wouldn't do any harm
to output className by default and for the BeanReader to use it if its there
though with stuff like RSS some folks might want to disable it to ensure
compliance with external DTDs or schemas etc. Ditto for ID generation etc.

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to