users@jaxb.java.net

Re: Customizing IDREF target type?

From: Ed Mooney <Ed.Mooney_at_sun.com>
Date: Wed, 11 Jun 2003 09:39:00 -0400

Hi Dennis,

Use a <baseType> customization. For example:

     <xs:attribute name="Idref" type="xs:IDREF">
       <xs:annotation>
         <xs:appinfo>
           <jaxb:property>
             <jaxb:baseType>
               <jaxb:javaType name="java.lang.String"
parseMethod="javax.xml.bind.DatatypeConverter.parseString"
printMethod="javax.xml.bind.DatatypeConverter.printString" />
             </jaxb:baseType>
           </jaxb:property>
         </xs:appinfo>
       </xs:annotation>
     </xs:attribute>

binds to:

     java.lang.String getIdref();
     void setIdref(java.lang.String value);

Regards,
--
Ed Mooney         |Sun Microsystems, Inc.|Time flies like
Java Web Services |UBUR02-201            |an arrow, but
Ed.Mooney_at_Sun.COM |1 Network Drive       |fruit flies like
781-442-0459      |Burlington, MA  01803 |a banana. Groucho
Dennis Sosnoski wrote:
> Is there anyway to specify that the target of an IDREF attribute is
> always going to be a specific type of element/object? I'd like the
> generated code to supply the appropriate object type for the get and set
> methods, rather than just "java.lang.Object getXXX()" and "void
> setXXX(java.lang.Object)". Thanks,
>
>  - Dennis