Flash> AMF> JAVA object ing

Source: Internet
Author: User

Types available for flash:

 

Code Package
{
Import Flash. utils. bytearray;

Public Class Valueobject
{
Public var stringvalue: string;
Public var intvalue: int;
Public var booleanvalue: Boolean;
Public var datevalue: date;
Public var numbervalue: number;
Public var bytesvalue: bytearray;

Public Function valueobject ()
{
}
}
}

 

 

Package
{
Public
Class Objectobject
{
Public var valueobject: valueobject;
Public var objectobject: objectobject;

Public Function objectobject ()
{
}
}
}

 

Code Package
{
Import MX. Collections. arraycollection;

PublicClassArrayobject
{
Public var arrayvalue: array;
Public var collectionvalue: arraycollection;
Public Function arrayobject ()
{
}
}
}

 

 

Receiving analysis:

1. Because the receiver uses AMF and the compression is carried by default, the basic types, binary and array types of flash transmission cannot be parsed and only objects can be received.

2. the receiver uses Java. newinstance () must be a public pojo class and cannot be embedded into other classes.

3. In addition to the public field, Java pojo must also have GetSet. Otherwise, beanmap cannot find the corresponding property.

 

4. arraycollection-> JAVA: arraycollection

5. bytearray-> byte []

6. array-> object []

 

7. Because Java does not support generic parameter acquisition types, collection cannot be implemented.

8. arraylist. toarray () = object [], cannot be converted to a specific XXX [], leading to the loss of class information during deserialization and the inability to map arrays to Java objects.

 

9. The flash recipient uses bytearray. readobject. Previously, registeralias was called to implement a strong transformation of flash.

Http://www.adobe.us/livedocs/flex/3_cn/langref/flash/net/package.html#registerClassAlias ()

 

10. If Java receives the package with AMF, the problem of sticking to the package may occur.

Http://bbs.9ria.com/viewthread.php? Tid = 45637

Http://bbs.9ria.com/viewthread.php? Action = printable & tid = 46012

 

 

Testcase:

Serialize --------------

1. valueobject-pass

2. objectobject-pass

3. arrayobject-pass

 

Deserialize --------------

1. valueobject-pass

2. objectobject-pass

3. arrayobject-pass

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.