You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Thomas Dudziak <to...@gmail.com> on 2005/05/16 11:07:01 UTC
Re: [Betwixt] Removing id attributes and conditional
> 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