Notes from following Daniel’s blog:
Java to ActionScript and ActionScript to Java type conversion
Java to ActionScript Type Conversion
| Java type | ActionScript type (AMF 3) |
|---|---|
| java.lang.String | String |
| java.lang.Integer | intIf i < 0xF0000000 || i > 0x0FFFFFFF, the value is promoted to Number. |
| java.lang.Byte | intIf i < 0xF0000000 || i > 0x0FFFFFFF, the value is promoted to Number. |
| java.lang.Double | Number |
| java.lang.Float | Number |
| java.lang.Character[] | String |
| java.util.Date | DateDates are sent in the UTC time zone. Clients and servers must adjust time accordingly for time zones. |
| java.util.Collection | mx.collection.ArrayCollection |
| java.util.Map | Object (untyped)In Flex 1.5, java.util.Map was sent as an associative or ECMA Array. This is no longer a recommended practice. You can enable legacy Map support to associative Arrays, but Adobe recommends against doing this. For more information, see Providing legacy AMF serialization on a channel |
| org.w3c.dom.Document | XML objectYou can enable legacy XML support for the XMLDocument type on any channel defined in the services-config.xml file. For more information, see Providing legacy AMF serialization on a channel. |
| Other classes that extend java.lang.Object | Object (typed)Objects are serialized using Java Bean introspection rules. Fields that are static, transient, or nonpublic are excluded. |
ActionScript to Java Type Conversion
| ActionScript type (AMF 3) | Deserialization to Java | Supported Java type binding |
|---|---|---|
| Array (dense) | java.util.List | java.util.Collection, Object[ ] (native array)If the type is an interface, it is mapped to the following interface implementations
A new instance of a custom Collection implementation is bound to that type. |
BooleanString of "true" or "false" |
java.lang.Boolean | Boolean, boolean, String |
| flash.utils.IExternalizable | java.io.Externalizable | |
| int/uint | java.lang.Integer | java.lang.Byte, java.lang.Double, java.lang.Float, java.lang.Long, java.lang.Short, java.math.BigDecimal, String, primitive types of byte, double, float, long, and short |
| number | java.lang.Double | java.lang.Byte, java.lang.Double, java.lang.Float, java.lang.Long, java.lang.Short, java.math.BigDecimal, String, 0 (zero) if null is sent, primitive types of byte, double, float, long, and short |
| String | java.lang.String | java.lang.String, java.lang.Boolean, java.lang.Number |
| undefined | null | null for Object, default values for primitives |
| XMLDocument(legacy XML type) | org.w3c.dom.Document | org.w3c.dom.DocumentYou can enable legacy XML support for the XMLDocument type on any channel defined in the services-config.xml file. This setting is only important for sending data from the server back to the client; it controls how org.w3c.dom.Document instances are sent to ActionScript. For more information, see Providing legacy AMF serialization on a channel. |
In “Calling Java remote objects and handling results” post, Daniel mentioned the asynchronous nature of Flex call to remote services, and suggested that one look into this link in Adobe Developer LiveDoc site:
Flex’s Asynchronous Call to services
Post a Comment
You must be logged in to post a comment.