users@jaxb.java.net

Re: Schema best practice for modeling UML association

From: Farrukh Najmi <farrukh_at_wellfleetsoftware.com>
Date: Fri, 11 Jan 2008 17:29:06 -0500

Answering my own question, I am assuming that the best practice would be
ID/IDREF as datatype for id attribute and dependsUpon attribute
respectively.:

 <complexType abstract="true" name="IdentifiableType">
   <attribute name="id" type="ID" use="required"/>
   <attribute name="dependsUpon" type="IDREF" use="optional"/>
 </complexType>

I am further assuming that Key/KeyRef is not advised as it is overly
complex and ugly.

Let me know if I am offbase.

On a related note, if I use the above schema, it generates a getter
method like the following:

Object getDependsUpon();

How can I customize it so it generated a getter method like:

IdentifiableType getDependsUpon();

Thanks.

Farrukh Najmi wrote:
> Dear Colleagues,
>
> I have the following simple schema that defines a type hierarchy with
> base IdentifiableType and derived types FooType and BarType.
> The BaseType defines an id attribute that uniquely identifies the
> object. It also defines a dependsUpon attribute which is intended to
> reference
> a concrete sub-type of IdentifiableType. I am looking for guidance on
> how to design my schema to that the generated bindings will use Java
> object reference exemplified by the getDependsUpon method below:
>
> Class IdentifiableType {
> String getId();
> IdentifiableType getDependsUpon();
> }
>
> What I want to avoid is a getter that returns the id value for the
> dependency object shown below:
> String getDependsUpon();
>
> The simplified schema is as follows and I have the flexibility to make
> changes to it to accomplish what I need in the bindings.
>
> <complexType abstract="true" name="IdentifiableType">
> <attribute name="id" type="anyURI" use="required"/>
> <attribute name="dependsUpon" type="anyURI" use="optional"/>
> </complexType>
> <complexType name="FooType">
> <complexContent>
> <extension base="tns:IdentifiableType">
> ....
> </extension>
> </complexContent>
> </complexType>
>
> <complexType name="BarType">
> <complexContent>
> <extension base="tns:IdentifiableType">
> ....
> </extension>
> </complexContent>
> </complexType>
>
> TIA for your help.
>


-- 
Regards,
Farrukh Najmi
Web: http://www.wellfleetsoftware.com