##### XDoclet

- Overview
- News and Status
- Download/Installation
- Using XDoclet
- Best Practices
- FAQ
- License

##### Ant Task Reference

- <doclet .. />
- <ejbdoclet .. />
- <hibernatedoclet .. />
- <jdodoclet .. />
- <jmxdoclet .. />
- <mockdoclet .. />
- <portletdoclet .. />
- <springdoclet .. />
- <tapestrydoclet .. />
- <webdoclet .. />
- <wseedoclet .. />

##### Tag Reference

- apache (@soap @struts @axis @tapestry)
- bea (@weblogic)
- borland (@bes)
- caucho (@resin)
- ejb (@ejb @dao)
- exolab (@castor)
- hp (@hpas)
- hibernate (@hibernate)
- ibm (@websphere)
- java (@javabean)
- jboss (@jboss)
- jdo (@jdo)
- jmx (@jmx)
- jsf (@jsf)
- macromedia (@jrun)
- mockobjects (@mock)
- mvcsoft (@mvcsoft)
- mx4j (@mx4j)
- objectweb (@jonas)
- oracle (@oc4j)
- orion (@orion)
- portlet (@portlet)
- pramati (@pramati)
- spring (@spring)
- sun (@sunone)
- sybase (@easerver)
- tjdo (@tjdo)
- web (@web @jsp)
- webwork (@webwork)
- wsee (@wsee)
- xdoclet (@xdoclet @doc @msg)

##### Feature Documentation

- Using Value Objects
- EJB Environment Handling

##### Advanced

- Maven Plug-in
- Merge Points
- IDE Integration
- Migration from EJBDoclet
- Ant 1.5 Troubleshooting

##### Community

- Feedback
- Resources
- Tools

##### Development

- Developer Guide
- Javadoc (API)
- Template Language (*.xdt)
- XJavaDoc Site

##### Search XDoclet

##### Project Documentation

- About XDoclet
- Project Info
- Project Reports
- Development Process

## @castor Tag Reference

The castormapping subtask produces a mapping.xml file for use by castor.

### @castor Class Level Tags

@castor.class

### @castor Method Level Tags

@castor.field
@castor.field-sql
@castor.field-xml

### @castor Field Level Tags

## @castor Class Level Tag Usage

### @castor.class (0..1)

Defines the class and its attributes. For full coverage of the mapping options, please refer to the Castor mapping documentation.

Parameter | Type | Applicability | Description | Mandatory
--- | --- | --- | --- | ---
table | text |  | The name of the table in the database that the class is mapped to. | true
id | text |  | The fields that form the class's primary key. | true
access | text |  | Define the access to the class. Valid options are: read-only shared exclusive db-locked Default value(s): shared | true
depends | text |  | The name of the class this class depends on. | false
extends | text |  | 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. | false
key-generator | text |  | The key-generator strategy to be used by Castor. | false
auto-complete | bool |  | If true, the class will be introspected to determine its field and the fields specified in the mapping file will be used to override the field found during the introspection. | false
ns-uri | text |  | The namespace URI to be used for the class. | false
ns-prefix | text |  | The namespace prefix to be used for the class. | false
verify-constructable | bool |  | true if constructor verification should be done, otherwise false | false

## @castor Method Level Tag Usage

### @castor.field (0..1)

Applies to: method level

Parameter | Type | Applicability | Description | Mandatory
--- | --- | --- | --- | ---
type | text |  | 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. | false
required | bool |  | Flag to indicate if the field is compulsory. Default value(s): true | false
direct | bool |  | Flag to indicate if the field should be accessed directly rather than using getter / setter methods. Default value(s): false | false
lazy | bool |  | Flag to indicate if the field loaded lazily. Default value(s): true | false
transient | bool |  | Flag to indicate if the field should be ignored during marshalling - useful when used with the auto-complete option of @castor.class. Default value(s): false | false
set-method | text |  | The method used to set the property value. | false
create-method | text |  | The factory method for instantiation of FieldHandler. | false
collection | text |  | Valid options are: array arraylist vector hashtable collection set map Default value(s): vector | false

### @castor.field-sql (0..1)

Applies to: method level

Parameter | Type | Applicability | Description | Mandatory
--- | --- | --- | --- | ---
name | text |  | The column name the field is mapped to. | true
type | text |  | The SQL type of the field. | true
many-key | text |  | The many key of the field. | true
many-table | text |  | The many table of the field. | true
dirty | bool |  | Flag to indicate if the field is checked for dirty status or not. Default value(s): true | false

### @castor.field-xml (0..1)

Applies to: method level

Parameter | Type | Applicability | Description | Mandatory
--- | --- | --- | --- | ---
name | text |  | The name of the element or attribute. | true
type | text |  | XML Schema type (of the value of this field) that requires specific handling in the Castor Marshalling Framework (such as 'QName' for instance). | false
matches | text |  | 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. | false
QName-prefix | text |  | When using a QName value, you can provide a default prefix that is used when marshalling value of type QName. | false
reference | bool |  | 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. Default value(s): true | false
node | 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. Valid options are: element attribute text Default value(s): text | false
dirty | bool |  | Flag to indicate if the field is checked for dirty status or not. Default value(s): true | false

## @castor Field Level Tag Usage