@castor Tag Reference

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

@castor Class Level Tags

@castor.class

@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.

ParameterTypeApplicabilityDescriptionMandatory
tabletext The name of the table in the database that the class is mapped to. true
idtextThe fields that form the class's primary key.true
accesstextDefine the access to the class.
Valid options are:

read-only

shared

exclusive

db-locked

Default value(s):

shared
true
dependstextThe name of the class this class depends on.false
extendstext 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-generatortextThe key-generator strategy to be used by Castor.false
auto-completebool 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-uritext The namespace URI to be used for the class. false
ns-prefixtext The namespace prefix to be used for the class. false
verify-constructablebooltrue if constructor verification should be done, otherwise falsefalse

@castor Method Level Tag Usage

@castor.field (0..1)

Applies to: method level

ParameterTypeApplicabilityDescriptionMandatory
typetext 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
requiredboolFlag to indicate if the field is compulsory.

Default value(s):

true
false
directbool Flag to indicate if the field should be accessed directly rather than using getter / setter methods.

Default value(s):

false
false
lazyboolFlag to indicate if the field loaded lazily.

Default value(s):

true
false
transientbool 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-methodtextThe method used to set the property value.false
create-methodtextThe factory method for instantiation of FieldHandler.false
collectiontext
Valid options are:

array

arraylist

vector

hashtable

collection

set

map

Default value(s):

vector
false

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

Applies to: method level

ParameterTypeApplicabilityDescriptionMandatory
nametextThe column name the field is mapped to.true
typetextThe SQL type of the field.true
many-keytextThe many key of the field.true
many-tabletextThe many table of the field.true
dirtyboolFlag 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

ParameterTypeApplicabilityDescriptionMandatory
nametextThe name of the element or attribute.true
typetext XML Schema type (of the value of this field) that requires specific handling in the Castor Marshalling Framework (such as 'QName' for instance). false
matchestext 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-prefixtext When using a QName value, you can provide a default prefix that is used when marshalling value of type QName. false
referencebool 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
nodetext 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
dirtyboolFlag to indicate if the field is checked for dirty status or not.

Default value(s):

true
false

@castor Field Level Tag Usage