commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jie...@gmail.com
Subject [betwixt] Skipping master element
Date Mon, 13 Apr 2009 17:14:57 GMT
Greetings,

I am trying to compose an object graph which will be output as XML,
using Betwixt. The problem I'm running into is that there is no easy
way to skip the owning element node. Example:

public class Creds { String username; String password; // getters and setters }
public class HostedCreds extends Creds { String hostname; // getters
and setters }

Creds.betwixt
<info primitiveTypes="element">
  <element name="credentials">
    <addDefaults />
  </element>
</info>

HostedCreds.betwixt
<info primitiveTypes="element">
  <element name="hostedCredentials">
    <addDefaults />
  </element>
</info>

output:
<hostedCredentials>
  <credentials>
    <username>foo</username>
    <password>bar</password>
  </credentials>
  <hostname>baz</hostname>
</hostedCredentials>

When I really want to be able to output:
<hostedCredentials>
  <username>foo</username>
  <password>bar</password>
  <hostname>baz</hostname>
</hostedCredentials>

The only way I can see to get this is to manually list all of the
Creds properties in HostedCreds.betwixt. Ugh. My real world problem
has many more properties for many more object graphs, and this is
quite painful. I can't find anything in the documentation, please
help!

Thanks!
-jesse

-- 
There are 10 types of people in this world, those
that can read binary and those that can not.

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


Mime
View raw message