commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Dudziak <tom...@gmail.com>
Subject Re: [Betwixt] Removing id attributes and conditional
Date Mon, 16 May 2005 09:07:01 GMT
> I'm writing some Java beans to XML and getting some odd results.
> Firstly, Betwixt is adding an "id" attribute to all my objects (see
> sample payment.xml below). How do I configure Betwixt stop this behaviour?

There is a configuration property for this which you'll set like this:

beanWriter.getBindingConfiguration().setMapIDs(false);

> I also would like to switch tags based on the type of an object
> returned. For example, I have a Customer object that returns a BankAccount:
> 
> //BankAccount.java
> public abstract class BankAccount {}
> 
> //Customer.java
> public class Customer {
>    BankAccount bankAccount;
>    public BankAccount getBankAccount() { return bankAccount; }
> }
> 
> //AustrianBankAccount.java
> public class AustrianBankAccount extends BankAccount {
> }
> 
> I have the following betwixt file which specifies that the root tag for
> an AustrianBankAccount is "bankAccount-AT":
> 
> //AustrianBankAccount.betwixt
> <?xml version="1.0" encoding="UTF-8" ?>
> <info primitiveTypes="element">
>    <element name="bankAccount-AT">
>      <addDefaults />
>    </element>
> </info>
> 
> But, in my results it still returns a "bankAccount" tag. How do I
> enforce this behaviour?

Handling of polymorphic references and collections has been added in
the current SVN Head (0.61-dev). Have a lokk e.g. at the this unit
test:

ttp://svn.apache.org/viewcvs.cgi/jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/TestReferenceMapping.java?view=markup

regards,
Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message