users@jaxb.java.net

Re: ToString plugin

From: Hanson Char <hanson.char_at_gmail.com>
Date: Thu, 14 Sep 2006 07:34:12 -0700

Excellent. Why not just make use of the Jakarta commons' EqualBuilder and
HashcodeBuilder ? Those I suppose they are widely used and therefore widely
tested.

The rest is just about hosting your plugin under the "right" categories so
people can find them.

Hanson

On 9/14/06, Aleksei Valikov <valikov_at_gmx.net> wrote:
>
> Hi.
>
> I've written a toString plugin for JAXB 2.x.
>
> For the XML:
>
> <heteroSequence>
> <sa>a</sa>
> <sb>b</sb>
> <sc>c</sc>
> <sd>d</sd>
> <se>e</se>
> <sf>
> <a>0</a>
> <b>1</b>
> </sf>
> </heteroSequence>
>
> And schema:
>
> <xs:element name="heteroSequence" type="heteroSequenceType"/>
> <xs:complexType name="heteroSequenceType">
> <xs:sequence>
> <xs:element name="sa" type="xs:string"/>
> <xs:element name="sb" type="xs:string"/>
> <xs:sequence>
> <xs:element name="sc" type="xs:string"/>
> <xs:element name="sd" type="xs:string"/>
> </xs:sequence>
> <xs:sequence maxOccurs="unbounded">
> <xs:element name="se" type="xs:string"/>
> <xs:element name="sf"
> type="sequenceType"/>
> </xs:sequence>
> </xs:sequence>
> </xs:complexType>
> <xs:complexType name="sequenceType">
> <xs:sequence>
> <xs:element name="a" type="xs:string"/>
> <xs:element name="b" type="xs:long"/>
> </xs:sequence>
> </xs:complexType>
>
> toString generates the following:
>
> heteroSequence(HeteroSequenceType {
> sa:a
> sb:b
> sc:c
> sd:d
> seAndSf:[e,
> SequenceType {
> a:0
> b:1
> }]
> })
>
> The plugin is the paret of hyperjaxb3-tools module.
>
> To build and test, check out hyperjaxb3 and mvn clean install it.
> After that go to tests/one and mvn test it there.
>
> Build-time dependencies are hyperjaxb3-tools and hyperjaxb3-runtime.
> Run-time dependency is hyperjaxb3-runtime only.
>
> This is not yet thoroughly tested. I just wanted to practise a bit with
> JAXB 2
> APIs before I start implementing hashCode/equals plugins.
>
> Bye.
> /lexi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>