Annotations -
java
- Constructor ConstructorData .external
-
The
Constructor
annotation describes a Java constructor that provides an implementation of a Ballerina function whose body is marked asexternal
. If the Ballerina function body is marked asexternal
, it means that the implementation of the function is not provided in the Ballerina source module.The following code snippet shows an example usage of this annotation. Here, the
newJavaLinkedList
Ballerina function's implementation is provided by the default constructor of thejava.util.LinkedList
class.import ballerinax/java; function newJavaLinkedList() returns handle = @java:Constructor { class: "java.util.LinkedList" } external;
- FieldGet FieldData .external
-
The
FieldGet
annotation describes a Java Field access that provides an implementation of a Ballerina function whose body is marked asexternal
.
- FieldSet FieldData .external
-
The
FieldSet
annotation describes a Java Field mutate that provides an implementation of a Ballerina function whose body is marked asexternal
.
- Method MethodData .external
-
The
Method
annotation describes a Java method that provides an implementation of a Ballerina function whose body is marked asexternal
. If the Ballerina function body is marked asexternal
, it means that the implementation of the function is not provided in the Ballerina source module.The following code snippet shows an example usage of this annotation. Here, the
getUUID
Ballerina function's implementation is provided by thejava.util.UUID.randomUUID
static method.import ballerinax/java; function getUUID() returns handle = @java:Method { name: "randomUUID", class: "java.util.UUID" } external;
The
name
field is optional. If it is not provided, the name of the Java method is inferred from the Ballerina function.