![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]()
|
The Source Code Generator Reference: For a more detailled version of the Source Generator documentation, download the Source Generator User Document(PDF). IntroductionSource Generator Options Command Line Options Collection Types Advanced Options Bound Properties Class Creation/Mapping The 'element' method The 'type' method Setting a super class Generate equals() method XML Schema IntroductionCastor's source code generator creates a set of Java classes which represent an object model for an XML Schema (W3C XML Schema, 200001024 Candidate Recommendation)1, as well as the necessary Class Descriptors used by the marshalling framework to obtain information about the generated classes. Example: This will generate a set of source files from the the XML Schema, foo-schema.xsd, and place them in the com/xyz/* package. To compile the generated classes simply run javac, or your favorite compiler: Created class will have marshal and unmarshal methods which are used to go back and forth between XML and an Object instance. Source Generator OptionsThe source code generator has a number of different options which may be set. Some of these are done using the command line, and others are done using a properties file. Command Line Options
Collection Types The source code generator has the ability to use the following types of collections when generating source code: Advanced OptionsBound PropertiesSince version: 0.8.9 Bound properties are "properties" of a class, which when updated the class will send out a java.beans.PropertyChangeEvent to all registered java.beans.PropertyChangeListeners. To enable bound properties uncomment the appropriate line in the "org/exolab/castor/builder/castorbuilder.properties" file: When enabled, all properties will be treated as bound properties. For each class that is generated a setPropertyChangeListener method is created as follows: Note: To prevent unnecessary overhead, if the property is a collection, the old value will be null. Class Creation/MappingSince version: 0.8.9 The source generator can treat the XML Schema structures such as complexType and element in two main ways. The first, and currently default method is called the "element" method. The other is called the "type" method. The 'element' methodThe "element" method creates classes for all elements whose type is a complexType. Abstract classes are created for all top-level complexTypes. Any elements whose type is a top-level type will have a new class create that extends the abstract class which was generated for that top-level complexType. Classes are not created for elements whose type is a simpleType. The 'type' methodThe "type" method creates classes for all top-level complexTypes, or elements that contain an "anonymous" (in-lined) complexType. Classes will not be generated for elements whose type is a top-level type. More information on this is forth coming. To change the "method" of class creation simple edit the castorbuilder.properties file: Setting a super classSince version: 0.8.10 The source generator enables the user to set a super class to all the generated classes (of course class descriptors are not concerned by this option) To set up the super class, edit the castorbuilder.properties file : Generate equals() methodSince version: 0.9.1 The Source Generator can override the 'equals()' method for the generated objects. Note: hashcode() is not currently overriden. To generate the equals() method , edit the castorbuilder.properties file : XML SchemaThe input file to the source code generator is an XML Schema2. The current supported version is the W3C XML Schema Candidate Recommendation1. For more information about XML Schema Support, check the XML Schema page 1Castor 0.9.0 uses XML Schema Candidate Recommendation 20001024 2XML Schema is a W3C Working Draft | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() ![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |