Arbortext Command Language > Functions by Alphabetical Listing > java_array_to_acl
  
java_array_to_acl
java_array_to_acl (obj, arr)
This function converts the Java object obj to the ACL array arr. All previous elements in the arr are discarded.
The obj parameter is a Java object. It belongs to one of the following classes:
A class that implements the java.util.Map interface. For example:
java.util.HashMap
java.util.HashTable
The resulting ACL array arr will be an ACL associative array.
A class that implements the java.util.List interface. For example:
java.util.ArrayList
java.util.Vector
The resulting ACL array arr will be an ACL normal array.
A one dimensional primitive type array.
The resulting ACL array arr will be an ACL normal array.
A one dimensional String array.
The resulting ACL array arr will be an ACL normal array.
Each element in the obj can be any Java object. Java String objects will be directly converted to ACL values. Other Java objects will be turned into Java String objects by using the Java toString method before converting to ACL values.
This function returns the size of the arr after the conversion. It returns -1 if the conversion failed.
# Create an ArrayList object
local obj = java_constructor("java.util.ArrayList");
java_instance(obj, "add", "English");
java_instance(obj, "add", "French");
local arr[];
local i;
# Convert the ArrayList object to an ACL array
local size = java_array_to_acl(obj, arr);
java_delete(obj);
for (i = 1; i <= size; i++) {
response("item " . i . " = " . arr[i]);
}
Related Topics
java_array_from_acl function
java_static function
java_constructor function
java_instance function