../../_images/Revised.png

4.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 4.31 Syntax
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<code_instruction>
        ...
        <field>
            name=""
            visibility=""
            access=""
            static=""
            final=""
            transient=""
            volatile=""
            code instruction base

            <apicommentline></apicommentline>
            <devcommentline></devcommentline>
            <import></import>
            <annotation></annotation>
            <datatype></datatype>
            <body></body>
            <getter_body></getter_body>
            <setter_body></setter_body>
            <annotation_getter></annotation_getter>
            <annotation_setter></annotation_setter>
        </field>
        ...
</code_instruction>

Fields

Table 4.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 4.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