[infinispan-dev] JAXB help needed

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[infinispan-dev] JAXB help needed

Pete Muir-2
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
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev
Reply | Threaded
Open this post in threaded view
|

Re: [infinispan-dev] JAXB help needed

Manik Surtani
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
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/infinispan-dev

--
Manik Surtani
[hidden email]
twitter.com/maniksurtani

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




_______________________________________________
infinispan-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/infinispan-dev