Hi,

On 03.02.2010 21:43, sleeloy99 wrote:

Thanks Ralf,

I am using caster 1.0.5 and it seems that it doesn't support arrays.  I was
getting an null pointer exception when I used collection="array".

I looked at the source code and it seems that it only supports vector,
arraylist and odmg.  The following is the code snippet from FieldInfoFactory


         CollectionInfo cInfo = null;
         if (temp.equals(VECTOR)) {
              cInfo = new CollectionInfo(contentType, name, elementName,
useJava50);
         } else if (temp.equals(ARRAY_LIST)) {
              cInfo = new CollectionInfoJ2(contentType, name, elementName,
"arraylist", useJava50);
         } else if (temp.equals(ODMG)) {
              cInfo = new CollectionInfoODMG30(contentType, name,
elementName, useJava50);
         }
//         else if (temp.equals("collection")) {
//            cInfo = new CollectionInfoJ2(contentType,name,elementName,
"collection");
//       } else if(temp.equalsIgnoreCase("set")) {
//            cInfo = new CollectionInfoJ2(contentType,name,elementName,
"set");
//        }


I guess there's no way to cause the source code generator to use my custom
implemented code instead of generating the file?
At a first glance, no. But I know that there's XML schema type(s) that cause byte[] to be generated. In other words, it should not be too hard to add that functionality.

And I am still not convincd that Ralf's suggestion does not work. Have you tried to use a binding file as suggested ?

Cheers
Werner



Ralf Joachim-2 wrote:

Hi,

by using a binding file you tell Castor the collection type to use. Take
a look at:
http://castor.codehaus.org/reference/html/xml.code.generator.html#d0e4904

Regards
Ralf


sleeloy99 schrieb:
Hi,

I would like to know if I can write a hook into the source code generator
to
generate a custom implementation for a particular xsd type.

I have a xsd type that has an unbounded element of type xs:byte.

             <xs:element name="content" type="xs:byte" minOccurs="0"
maxOccurs="unbounded">
             </xs:element>

This property gets generated as  java.lang.Vector<java.lang.Byte>.  I
want
to change the implementation so that I use a byte array (byte[]).  The
Vector<Byte>  is taking up too much memory so I need to provide my own
custom
implementation for this xsd type.

Is there a way in Castor to hook into the source code generator to
accomplish this?

Thanks.


--

Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
Ralf Joachim
Raiffeisenstraße 11
72127 Kusterdingen
Germany

Tel.   +49 7071 3690 52
Mobil: +49 173 9630135
Fax    +49 7071 3690 98

Internet: www.syscon.eu
E-Mail: [email protected]

Sitz der Gesellschaft: D-72127 Kusterdingen
Registereintrag: Amtsgericht Stuttgart, HRB 382295
Geschäftsleitung: Jens Joachim, Ralf Joachim


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

     http://xircles.codehaus.org/manage_email






---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to