5.4.2.4. Field

<field> is a child element of <class> or <interface> and defines the generation of a mapped Java type property, such as int, Integer, String, date etc.

Each field is a Java property of a Class or Interface.

Loupe S See also: Maps and Mappings

Usage

The name attribute is mandatory and indicates the name of the field.

Listing 5.31 Syntax
 1<code_instruction>
 2        ...
 3        <field>
 4            name=""
 5            visibility=""
 6            access=""
 7            static=""
 8            final=""
 9            transient=""
10            volatile=""
11            code instruction base
12
13            <apicommentline></apicommentline>
14            <devcommentline></devcommentline>
15            <import></import>
16            <annotation></annotation>
17            <datatype></datatype>
18            <body></body>
19            <getter_body></getter_body>
20            <setter_body></setter_body>
21            <annotation_getter></annotation_getter>
22            <annotation_setter></annotation_setter>
23        </field>
24        ...
25</code_instruction>

Fields

Table 5.36 attributes of <field/>

Name

Details

name

The name of the java field that is made (also called the field or property).

visibility

Visibility of this field. Possible values are public, protected en private.

access

The access field determines whether getters and setters should be created. Possible values are ro, rw and wo. With ro (readonly) only the getter is generated. With rw (readwrite) both getter and setter are generated. With wo (writeonly) only the setter is generated. If the access field is omitted, then neither getter nor setter is generated.

static

true or false. Indicates whether or not the field should be defined static.

final

true or false. Indicates whether or not the field should be defined final.

transient

true or false. Indicates whether or not the field should be defined as transient.

volatile

true or false. Indicates whether or not the field should be defined volatile.

code instruction base

Loupe S Code instruction base.

Sub elements

Table 5.37 sub elements of <field/>

Name

Details

Number

apicommentline

Javadoc that is attached to this field.

0 or 1

devcommentline

Commentary that is attached to this attribute.

0 or 1

import

The value of this field is attached as an import statement to the class or interface in which this attribute is defined.

0 or 1

annotation

Annotation defined for the attribute.

0 or more

datatype

Question S

0 or 1

body

The contents of the field.

0 or 1

getter_body

Question S

0 or 1

setter_body

Question S

0 or 1

annotation_getter

Question S

0 or 1

annotation_setter

Question S

0 or 1