Namespace Java
Utility methods for interacting with Java methods and objects.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
Java.convertMap(map)
Converts a Java Map into a JavaScript Object so that users
can access properties like this: object.property
instead of having to do this: map.get('property').
|
<static> |
Java.convertObject(obj)
Recursively converts a Java object into a JavaScript Object by converting Maps to javascript maps and Lists to javascript
arrays.
|
Method Detail
<static>
{Object}
Java.convertMap(map)
Converts a Java Map into a JavaScript Object so that users
can access properties like this: object.property
instead of having to do this: map.get('property').
Converts to native Javascript Date, String and Boolean objects from java objects of the same.
Null values are converted to empty JavaScript strings. For direct access to the Java objects, call the Map object directly.
- Parameters:
- {Map} map
- The associative array that will be converted into an Object.
- Returns:
- A JavaScript
Object
whose members and member values match the key value pairings of the passed map.
- See:
- String#escapeJS For details on how map keys are converted to JavaScript-safe variable names.
<static>
{Object}
Java.convertObject(obj)
Recursively converts a Java object into a JavaScript Object by converting Maps to javascript maps and Lists to javascript
arrays. This method assumes all map keys are strings.
This method does not modify key names or attempt to determine object types based on their values, ie. dates that are
represented as integers will remain integers. This simply provides the closest possible javascript representation of a
Java object
- Parameters:
- {Object} obj
- The java object that will be converted into a javascript Object.
- Returns:
- A JavaScript
Object
whose members and member values match the key value pairings of the passed object.