commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Kendall" <>
Subject [betwixt] Nested Mixed Content Lists
Date Tue, 22 May 2007 19:43:01 GMT
OK, so I have a really stupid question, but I've been banging my head
against it all day, so it's time to ask for some help. I have two
mixed content lists, one is a list of Matcher objects and each Matcher
list contains a list of Selector objects. Both Matcher and Selector
are abstract types. Matchers are contained in a Transform object. The
whole thing would look something like this:

public class Transform {
	private List<Matcher> matchers = new ArrayList<Matcher>();
	public void addMatcher(Matcher matcher) {
	public List<Matcher> getMatchers() {
		return matchers;

public abstract class Matcher {
	private List<Selector> selectors = new ArrayList<Selector>();

	protected abstract Set<Long> doSomething();

	public void addSelector(Selector selector) {

	public List<Selector> getSelectors() {
		return selectors;

public abstract class Selector {
  public abstract void doSomething();

Now, reading the documentation, I found this little gem:

  <element name="transform">
    <element name="matchers">
      <element property="matchers" adder="addMatcher"/>
    <addDefaults add-adders="false"/>

And, naively, I also created:

  <element name="matcher">
    <element name="selectors">
      <element property="selectors" adder="addSelector"/>
    <addDefaults add-adders="false"/>

Using the latest betwixt 0.8 release this does not, sadly, give me
what I want. Just guessing, it looks like the name="matcher" attribute
from my AnInstanceOfMatcher.betwixt overrides the Transform.betwixt's
naming instructions. Here's my output:

<transform id="3">
    <matcher id="4">
	<PathFieldSelector id="5">
	<NamedFieldSelector id="6">

As you can see, the Selectors are named properly, but the type of the
Matcher remains a mystery. What is the proper way to map this?

Please note that I would prefer a strategy that doesn't require a lot
of extra attributes and elements. Once I get the actual mapping
working, I'll be toning down the complexity of the file so that it can
be easily edited by hand.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message