users@jaxb.java.net

Generating custom method

From: Saurabh Arora <sarora_at_novell.com>
Date: Fri, 06 Jun 2003 02:37:52 -0600

Is it possible to generate custom method for a schema.

Like for each multi value element i would like to add the method
addXYS()

For example
ave a simple xsd as below,

<xsd:element name="A" >
        <xsd:complexType >
                <xsd:attribute name="ID" type="xsd:string"
use="required"/>
                <xs:element name="zip" type="xs:integer" minOccurs="0"
maxOccurs="unbounded" />
        </xsd:complexType>
</xsd:element>


I endup getting classes like

AType

with method

java.util.List getZips()


Is it possible to add custom method( through custom extension) so that
we get the function

addzip(Zip zp1)
{
 getZips().add(zp1);
}


It also gives the advantage for moving the responsibility to add Zip's
to the JAXB code then user. Since just exposing getZips as List can lead
to problem if the user expects adds a wrong entry.
Ex

getZips().add(new Object());


Is it possible to add such customization to the xsd.

saurabh arora