What is your setting for the property org.exolab.castor.builder.javaclassmapping
in the src\main\org\exolab\castor\builder\castorbuilder.properties file?
-----Original Message-----
From: Trace Windham [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 14, 2002 10:41 AM
To: [EMAIL PROTECTED]
Subject: [castor-dev] Java containment vs. inheritance using the Source Generator

I have been using the Source Generator for about a month now, and I am having trouble figuring out how and/or if I can use containment instead of inheritance in my generated source code.


Here is some example of my shcemas that I am using to generate source code.

.......
<xsd:element name="note">
   <xsd:complexType>
      <xsd:sequence>
          <xsd:element name="author" type="user"/>
          <xsd:element name="text" type="xsd:string"/>
       </xsd:sequence>
   </xsd:complexType>
</xsd:element>
........

<xsd:complexType name="user">
    <xsd:sequence>
       <xsd:element name="userId" type="xsd:string"/>
        <xsd:element name="role" type="xsd:string"/>
        <xsd:element name="firstName" type="xsd:string"/>
        <xsd:element name="lastName" type="xsd:string"/>
     </xsd:sequence>
</xsd:complexType>

The resulting generated source code has the following two classes, A User class, and an Author class, among other java files.  The User class is abstract and the Author class extends the User class.  The Note class that is generated has a field called author that is of type Author. 

The problem here is that I don't want the Author class.   I would rather have the Note class have a field called author that is of type user.  Is it possible for such things to happen using the Source Generator?  If so, how?

Here is some sample java source code just in case my ramblings above made no sense.

There are two sections of code.  The first one is what really comes out of the generator using my schema files, and the second one is the what I would like to see come out of the generator, but I haven't figured out how to do it yet.  In fact, I don't even know if the generator can do what I would like it to do.


This is what comes out:
public class Note {
	...
	private Author _author;
	...
}

public class Author extends User {
	...
}

public abstract class User {
	...
}
And this is what I want to come out:
public class Note {
	...
	private User _author;
	...
}

public class User {
	...
}
I use the User object a lot, and I was hoping to avoid having a class generated that really doesn't do anything except extend User everytime I use the User class in this way. 

Thank you for your time.
Trace Windham
+

Reply via email to