Annotations -
java
-
Constructor ConstructorData
external
-
The
Constructorannotation 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
newJavaLinkedListBallerina function's implementation is provided by the default constructor of thejava.util.LinkedListclass.import ballerinax/java; function newJavaLinkedList() returns handle = @java:Constructor { class: "java.util.LinkedList" } external;
-
FieldGet FieldData
external
-
The
FieldGetannotation describes a Java Field access that provides an implementation of a Ballerina function whose body is marked asexternal.
-
FieldSet FieldData
external
-
The
FieldSetannotation describes a Java Field mutate that provides an implementation of a Ballerina function whose body is marked asexternal.
-
Method MethodData
external
-
The
Methodannotation 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
getUUIDBallerina function's implementation is provided by thejava.util.UUID.randomUUIDstatic method.import ballerinax/java; function getUUID() returns handle = @java:Method { name: "randomUUID", class: "java.util.UUID" } external;The
namefield is optional. If it is not provided, the name of the Java method is inferred from the Ballerina function.