java arraycollection,数的ActionScript / Flex的ArrayCollection的对象以Java集合<龙>使用BlazeDS的...

I am using Flex 3 and make a call through a RemoteObject to a Java 1.6 method and exposed with BlazeDS and Spring 2.5.5 Integration over a SecureAMFChannel. The ActionScript is as follows (this code is an example of the real thing which is on a separate dev network);

import com.adobe.cairngorm.business.ServiceLocator;

import mx.collections.ArrayCollection;

import mx.rpc.remoting.RemoteObject;

import mx.rpc.IResponder;

public class MyClass implements IResponder

{

private var service:RemoteObject = ServiceLocator.getInstance().getRemoteOjbect("mySerivce");

public MyClass()

{

[ArrayElementType("Number")]

private var myArray:ArrayCollection;

var id1:Number = 1;

var id2:Number = 2;

var id3:Number = 3;

myArray = new ArrayCollection([id1, id2, id3]);

getData(myArray);

}

public function getData(myArrayParam:ArrayCollection):void

{

var token:AsyncToken = service.getData(myArrayParam);

token.addResponder(this.responder); //Assume responder implementation method exists and works

}

}

This will make a call, once created to the service Java class which is exposed through BlazeDS (assume the mechanics work because they do for all other calls not involving Collection parameters). My Java service class looks like this;

public class MySerivce {

public Collection getData(Collection myArrayParam) {

//The following line is never executed and throws an exception

for (Long l : myArrayParam) {

System.out.println(l);

}

}

}

The exception that is thrown is a ClassCastException saying that a java.lang.Integer cannot be cast to a java.lang.Long. I worked around this issue by looping through the collection using Object instead, checking to see if it is an Integer, cast it to one, then do a .longValue() on it then add it to a temp ArraList. Yuk.

The big problem is my application is supposed to handle records in the billions from a DB and the id will overflow the 2.147 billion limit of an integer. I would love to have BlazeDS or the JavaAdapter in it, translate the ActionScript Number to a Long as specified in the method. I hate that even though I use the generic the underlying element type of the collection is an Integer. If this was straight Java, it wouldn't compile.

Any ideas are appreciated. Solutions are even better! :)

解决方案

Please read the following threads related to your issue. You can find there some workarounds.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值