The castormapping subtask produces a mapping.xml file for use by castor. It is a subtask of the ejbdoclet task.
Attribute | Description | Required |
destdir | Base destination directory for the generated source code. | No, default is destdir parameter of ejbdoclet task |
validateXml | Validates the generated xml file according to the DTD file contained inside xdoclet.jar. | No, default is false |
Defines the class and its attributes.
For full coverage of the mapping options, please refer to the Castor Mapping documentation.
Parameter | Usage |
[table]: String | The name of the table in the database that the class is mapped to. |
[id]: String | The fields that form the class's primary key. |
[access]: "read-only" | "shared" | "exclusive" | "db-locked" | Define the access to the class. |
[depends]: String | The name of the class this class depends on. |
[extends]: String | Should be used only if this class extends another class for which mapping information is provided. It should not be used if the extended class is not used in the mapping file. |
[key-generator]: String | The key-generator strategy to be used by Castor. |
[auto-complete]: "true" | "false" | If true, the class will be introspected to determine its field and the fields specified in the mapping file will be used to overide the field found during the introspection. |
Parameter | Usage |
[type]: String | The Java type of the field. It is used to access the field. Castor will use this information
to cast the XML information (like string into integer). It is also used to define the signature
of the accessors method. If a collection is specified, this is used to specify the type of the
object inside the collection. If type is not specified it defaults to the return type of the method. WARNING: You need to specify the type explicitly if the return type is an 'int' (specify the value 'integer') or if the return type is an array (specify the type without brackets). |
[required]: "true" | "false" | Flag to indicate if the field is compulsory. |
[direct]: "true" | "false" | Flag to indicate if the field should be accessed directly rather than using getter / setter methods. |
[lazy]: "true" | "false" | Flag to indicate if the field loaded lazily. |
[transient]: "true" | "false" | Flag to indicate if the field should be ignored during marshalling - usefull when used with the auto-complete option of @castor:class. |
[set-method]: String | The method used to set the property value. |
[create-method]: String | The factory method for instantiation of FieldHandler. |
[collection]: "array" | "vector" | "hashtable" | "collection" | "set" | "map" | The type of the collection the field is. |
Parameter | Usage |
[name]: String | The column name the field is mapped to. |
[type]: String | The SQL type of the field. |
[many-key]: String | The many key of the field. |
[many-table]: String | The many table of the field. |
[dirty]: "true" | "false" | Flag to indicate if the field is checked for dirty status or not. |
Parameter | Usage |
[name]: String | The name of the element or attribute. |
[type]: String | XML Schema type (of the value of this field) that requires specific handling in the Castor Marshalling Framework (such as 'QName' for instance). |
[matches]: String | Allows overriding the matches rules for the name of the element. It is a standard regular expression and will be used instead of the 'name' field. |
[QName-prefix]: String | When using a QName value, you can provide a default prefix that is used when marshalling value of type QName. |
[reference]: "true" | "false" | Indicates if this field has to be treated as a reference by the unmarshaller. In order to work properly, you must specify the node type to 'attribute' for both the 'id' and the 'reference' fields. |
[node]: "element" | "attribute" | "text" | Indicates if the name corresponds to an attribute, an element, or text content. By default, primitive types are assumed to be an attribute otherwise the node is assumed to be an element. |