[infinispan-dev] JAXB help needed

Manik Surtani manik at jboss.org
Wed May 18 12:22:02 EDT 2011


I presume you want:

<colocationGroup>
	<groupGenerator class="a.b.c.D1" forType="a.b.c.X1" />
	<groupGenerator class="a.b.c.D2" forType="a.b.c.X2" />
	<groupGenerator class="a.b.c.D3" forType="a.b.c.X3" />
</colocationGroup >

in which case you'd need:

@XmlAccessorType(XmlAccessType.PROPERTY)
class ColocationGroupCfg ... {
  List<GroupGeneratorCfg> groupGeneratorCfgs = new LinkedList< GroupGeneratorCfg>();
  
  @XmlElement(name="groupGenerator")
  public void setGroupGeneratorCfgs(List<GroupGeneratorCfg> l) { ... }
}

class GroupGeneratorCfg ... {
    @XmlAttribute(name="class") String clazz;
    @XmlAttribute String forType;
}

Vladimir can confirm though, he's our resident JAXB wizard.  :)

On 18 May 2011, at 15:17, Pete Muir wrote:

> As usual I'm struggling with JAXB. What I want to do is pretty trivial with a stream based parser:
> 
> 1) parse a xs:sequence into a list of strings
> 2) receive notification that this list of strings has been parsed via a post parse callback
> 3) create a list of object instances (each string represents a class name)
> 4) set this into the domain model for configuration
> 
> I have absolutely no idea how I do this with jaxb (and no real desire to learn, which is probably the main problem ;-), so can someone help me?
> 
> For now I'll just add this to the fluent config and not expose it via xml.
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev

--
Manik Surtani
manik at jboss.org
twitter.com/maniksurtani

Lead, Infinispan
http://www.infinispan.org






More information about the infinispan-dev mailing list