5.4.2.5. Method
<method> is a child element of <class> or <interface> and defines a Java method.
Usage
The name attribute is mandatory and indicates the name of the method. Syntax of the method element:
1<code_instruction>
2 ...
3 <method>
4 name=""
5 visibility=""
6 static=""
7 abstract=""
8 final=""
9 synchronized=""
10 default=""
11 code instruction base
12
13 <apicommentline></apicommentline>
14 <devcommentline></devcommentline>
15 <import></import>
16 <annotation></annotation>
17 <body></body>
18
19 <parameter name="">
20 <datatype></datatype>
21 </parameter>
22
23 <exception>
24 <apicommentline></apicommentline>
25 <devcommentline></devcommentline>
26 <import></import>
27 <annotation></annotation>
28 <datatype></datatype>
29 </exception>
30 </method>
31 ...
32</code_instruction>
Attributes
Name |
Details |
---|---|
name |
The name of the java method made. When you name it “constructor” it will create a constructor. |
visibility |
Visibility of the method. Possible values are public, protected en private. If left empty, then private is used. |
static |
true or false. Indicates whether or not the method should be defined static. |
abstract |
true or false. Indicates whether or not the method should be defined abstract. |
final |
true or false. Indicates whether or not the method should be defined final. |
synchronized |
|
default |
|
code instruction base |
Sub elements
Name |
Details |
Number |
---|---|---|
apicommentline |
Javadoc that is attached to this method. |
0 or more |
devcommentline |
Commentary that is attached to this attribute. |
0 or more |
import |
All library elements under import are translated as import statements. |
0 or more |
annotation |
Annotation defined for the attribute. |
0 or more |
body |
The contents of the method. |
0 or 1 |
Parameter of this method. The parameter with the name ‘return is reserved for specifying the return parameter. |
0 or more |
|
Exception thrown by this method. |
0 or 1 |
Reference to Sub elements