users@jaxb.java.net

Re: How to bind existing class into schema generation?

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Tue, 21 Apr 2009 12:59:23 +0200

At first glance, I'd say that you'll have to substitute PointType with a
class that mimics the List<x> container, wherein you can use your
MYOwnAndAlreadyExistingClass.

The parse/print for list would call parse/print from
de.myadapter.KmlCoordinatesConverter.
-W



On Tue, Apr 21, 2009 at 10:58 AM, Florian Bachmann
<f.bachmann_at_micromata.de>wrote:

> Hi, it’s me again (-:
>
> How could I integrate an existing class into my generated classes? (I’m
> tied to use a given schema and could not change it.)
>
> The schema compiler produces this class:
>
> public class PointType extends AbstractGeometryType {
>
> @XmlList
>
> protected List<String> coordinates;
>
> }
>
>
>
>
>
> Could I, or how could I tell the schema compiler, that I rather like to
> have a List of coordinates with my own (and already existing) class?
>
> protected List<MYOwnAndAlreadyExistingClass> coordinates;
>
>
>
> The relevant parts of my schema are:
>
> <simpleType name="coordinatesType">
>
> <list itemType="string" />
>
> </simpleType>
>
> <element name="coordinates" type="kml:coordinatesType" />
>
>
>
> <element name="Point" type="kml:PointType"
> substitutionGroup="kml:AbstractGeometryGroup" />
>
> <complexType name="PointType" final="#all">
>
> <complexContent>
>
> <extension base="kml:AbstractGeometryType">
>
> <sequence>
>
> <element ref="kml:coordinates" minOccurs="0" />
>
> </sequence>
>
> </extension>
>
> </complexContent>
>
> </complexType>
>
> I tried a mapping like:
>
> <jaxb:javaType xmlType="kml:coordinatesType"
> name="de.myClass.MyOwnAndAlreadyExistingClass"
>
> parseMethod="de.myadapter.KmlCoordinatesConverter.parse"
>
> parseMethod="de.myadapter.KmlCoordinatesConverter.print"
>
> />
>
> but then the List disappeared:
>
> protected MYOwnAndAlreadyExistingClass coordinates;
>
>
>
> So how could I bind an existing class into my generated class files and
> don’t destroy the creations of the list. I hope you understand my
> explanations and could hopefully help me.
>
>
>
> regards
>
> Flori
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>