Method bodies look largely like Java. References to java classes must be fully qualified. Several special variables are used:
$0
first parameter, equivalent to this
in Java code (and can't be used when creating a static method) $1, $2, ...
actual parameters to the method $args
all the parameters as an Object[]
$r
the return type of the method, typically used as return ($r) ...
. $r
is valid with method that return void
. This also handles conversions between wrapper types and primitive types. $w
conversion from primitive type to wrapper type, used as ($w) foo()
where foo()
returns a primitive type and a wrapper type is needed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|