users@jaxb.java.net

Re: Use of jaxb:class/_at_implClass

From: Jochen Wiedmann <jochen.wiedmann_at_softwareag.com>
Date: Tue, 09 Sep 2003 22:26:49 +0200

Kohsuke Kawaguchi wrote:

> The implClass customization is not intended to have you implement the
> class from scratch. It's rather to have you derive your own class from
> what's produced from the RI.
>
> So you should leave those methods untouched.

But that's not what the xjc seems to generate. I have the schema below.
This generates (as I had expected) a class called MyClassImpl, which is
extending net.sf.jaxme.test.misc.jaxb.impl.SomeClass.


Regards,

Jochen



<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xml:lang="EN"
     targetNamespace="http://jaxme.sf.net/test/misc/jaxb"
     xmlns:jx="http://jaxme.sf.net/test/misc/jaxb"
     xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
     elementFormDefault="qualified"
     attributeFormDefault="unqualified"
     jaxb:version="1.0">
   <xs:annotation>
     <xs:documentation>
       Demonstration of the jaxb:class and jaxb:property elements
     </xs:documentation>
     <xs:appinfo>
       <jaxb:globalBindings
         typesafeEnumBase="xs:string xs:int xs:long xs:short xs:double
xs:float"/>
     </xs:appinfo>
   </xs:annotation>

   <xs:element name="MyClass">
     <xs:annotation>
       <xs:documentation>This element would by default be called "MyClass".
         We use an instance of jaxb:class to rename it to "SomeClass".
         Likewise, the implementation would by default be called
         "SomeClassImpl". We move it to a subpackage "impl" and call it
         "SomeClass".
       </xs:documentation>
     </xs:annotation>
     <xs:complexType>
       <xs:annotation>
         <xs:appinfo>
           <jaxb:class name="SomeClass"
               implClass="net.sf.jaxme.test.misc.jaxb.impl.SomeClass">
             <javadoc>This is the implementation of the XML element
"MyClass".</javadoc>
           </jaxb:class>
         </xs:appinfo>
       </xs:annotation>
       <xs:sequence>
         <xs:element name="x" type="xs:int">
           <xs:annotation>
             <xs:documentation>
               This attribute would by default be called have a getter
"getX()" and
               a setter "setX()". We rename these to "getSomeElement()" and
               "setSomeElement()".
             </xs:documentation>
             <xs:appinfo>
               <jaxb:property name="SomeElement"/>
             </xs:appinfo>
           </xs:annotation>
         </xs:element>
       </xs:sequence>
       <xs:attribute name="foo" type="xs:string">
         <xs:annotation>
           <xs:documentation>
             This attribute would by default be called have a getter
"getFoo()" and
             a setter "setFoo()". We rename these to "getSomeAttribute()" and
             "setSomeAttribute()".
           </xs:documentation>
           <xs:appinfo>
             <jaxb:property name="SomeAttribute"/>
           </xs:appinfo>
         </xs:annotation>
       </xs:attribute>
     </xs:complexType>
   </xs:element>
</xs:schema>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net