
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 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | <code_instruction>
...
<method>
name=""
visibility=""
static=""
abstract=""
final=""
synchronized=""
default=""
code instruction base
<apicommentline></apicommentline>
<devcommentline></devcommentline>
<import></import>
<annotation></annotation>
<body></body>
<parameter name="">
<datatype></datatype>
</parameter>
<exception>
<apicommentline></apicommentline>
<devcommentline></devcommentline>
<import></import>
<annotation></annotation>
<datatype></datatype>
</exception>
</method>
...
</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