Print
CastorTags

@castor.class

Defines classes that should have a mapping definition. Applies to: Java Bean

Unique true

Allowed locations

class method constructor field
true false false false
Parameter Required Allowed values Default value Array Token separator Description
depends false Any value   no   The name of the class this class depends on
extends false Any value   no   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.
auto-complete false true, false   no   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.
identity false Any value   no   The fields that form the class's primary key.
access false read-only, shared, exclusive, db-locked   no   Define the access to the class.
key-generator false Any value   no   The key-generator strategy to be used by Castor.
description false Any value   no   An optional description.
table false Any value   no   The name of the table in the database that the class is mapped to.
xml false Any value   no   The fields that form the class's xml mapping name
ns-uri false Any value   no   The namespace URI to be used for the class.
ns-prefix false Any value   no   The namespace prefix to be used for the class.
ldap-dn false Any value   no   The namespace prefix to be used for the class.
ldap-oc false Any value   no   The namespace prefix to be used for the class.
cache-type false none, count-limited, time-limited, unlimited   no   Cache type
cache-capacity false Any value   no   Cache capacity
verify-constructable false true, false   no   True if constructor verification should be done, otherwise false. <br>

NOTE: This is an undocumented option.

<a href="http://castor.codehaus.org/xml-mapping.html#7.4-Preventing-Castor-from-checking-for-a-default-constructor">7.4-Preventing-Castor-from-checking-for-a-default-constructor</a>

@castor.field-sql

Defines methods/fields that should have a mapping definition. Applies to: Java Bean

Unique true

Allowed locations

class method constructor field
false true false true
Parameter Required Allowed values Default value Array Token separator Description
name false Any value   no   The name of the column in the database table
type false Any value   no   The JDBC type of the column. It is inferred from the object when the type of this

field is a persistent Java class that is defined elsewhere in the mapping. The

complete list of automatic type conversions, and which values require manual

mapping (e.g, java.util.Date) is listed in the SQL Type Conversion section of

the Type Support document.
many-key false Any value   no   Specifies the name of the column that holds the foreign key to this object. That column is in the

database table that stores objects of the Java type of this field.
many-table false Any value   no   Specifies the name of the bridge table that contains the primary keys of the object on each side of

the relationship. This is only used for many-to-many relationships
read-only false true, false   no   If true, the column in the relational database table will only be read, not updated or deleted.
dirty false check, ignore   no   If the value is 'ignore', the field will not be checked against the database for modification.
transient false true, false   no   ?? No doc found. Present in DTD

@castor.field

Defines methods/fields that should have a mapping definition. Applies to: Java Bean

Unique true

Allowed locations

class method constructor field
false true false true
Parameter Required Allowed values Default value Array Token separator Description
type false Any value   no   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.
required false true, false   no   Flag to indicate if the field is compulsory.
direct false true, false   no   Flag to indicate if the field should be accessed directly rather than using getter / setter methods
lazy false true, false   no   Flag to indicate if the field loaded lazily.
transient false true, false   no   Flag to indicate if the field should be ignored during marshalling - useful when used with the

auto-complete option of @castor.class
handler false Any value   no   Field handler to use
set-method false Any value   no   The method used to set the property value
get-method false Any value   no   The method used to get the property value
create-method false Any value   no   The factory method for instantiation of FieldHandler
collection false array, arraylist, vector, hashtable, collection, set, map   no   The factory method for instantiation of FieldHandler

@castor.field-xml

Defines methods/fields that should have a mapping definition. Applies to: Java Bean

Unique true

Allowed locations

class method constructor field
false true false true
Parameter Required Allowed values Default value Array Token separator Description
name false Any value   no   The name of the element or attribute
type false Any value   no   XML Schema type (of the value of this field) that requires specific handling in the Castor Marshalling

Framework (such as 'QName' for instance)
location false Any value   no   Allows the user to specify the "sub-path" for which the value should be marshalled to and from. This

is useful for "wrapping" values in elements or for mapping values that appear on sub-elements to the

current "element" represented by the class mapping.
matches false Any value   no   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 false Any value   no   When using a QName value, you can provide a default prefix that is used when marshalling value of type

QName
reference false true, false   no   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 false element, attribute, text   no   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
auto-naming false deriveByClass, deriveByField   no   If no name is specified this attribute controls how castor will automatically create a name for the

field. Normally the name is created using the field name, however many times it is necessary to

create the name by using the class type instead (such as heterogenenous collections).
transient false true, false   no   Allows for making this field transient for XML. The default value is inherited from the <field> element.
Powered by Atlassian Confluence