Java Mailing List Archive

http://www.junlu.com/

Home » user.castor »

[castor-user] [castor-codegen] java.util.Date in custom binding

Bartosz Michalik

2013-01-25


Author LoginPost Reply
Dear all,
I am having an issue with castor configuration.
In my use case scenario Java classes are generated from schemas.
I am trying to introduce a custom binding from xs:string field to
java.util.Date

Example of a schema:

 <xs:complexType name="Element">
         <xs:sequence>
    <xs:attribute name="type" type="xs:string" use="required"/>
    <xs:attribute name="date" type="xs:string" use="optional"/>  
 </xs:complexType>

Our binding file

<binding xmlns="http://www.castor.org/SourceGenerator/Binding"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.castor.org/SourceGenerator/Binding
http://www.castor.org/binding.xsd"
    >

 <complexTypeBinding name="Element">
   <java-class name="NewElementName" />
   <attributeBinding name="date" >
     <member java-type="java.util.Date"
handler="our.customized.Handler" />
   </attributeBinding>
 </complexTypeBinding>  
</binding>

Unfortunatelly, in a generated code the 'date' filed is of type
*org.exolab.castor.types.Date*.
I have observed this behaviour using castor 1.0.5 (due to legacy reasons we
use this version) as well as with castor 1.3.

Any ideas/suggestins how to approach this problem ? For any other type than
j.u.Date it works as expected.
Best regards,
Bartosz

--
Bartosz Michalik

Attachment: smime.p7s (zipped)
©2008 junlu.com - Jax Systems, LLC, U.S.A.