I got a new problem now when the price is filled by the user. Everything
works when the price is null (Thanks for ur solution)

While converting the price to "java.lang.Double", I am getting error "Cannot
convert java.lang.String to java.lang.Double?

After debugging RemoteCallUtils.toJava(), I have seen the following line
getting skipped 
Class actualTargetType;
            Class sourceType = obj.getClass();
            if (targetType == Integer.TYPE) {
                actualTargetType = Integer.class;
            } else if (targetType == Boolean.TYPE) {
                actualTargetType = Boolean.class;
            } else if ((targetType == Double.TYPE || targetType ==
Double.class) &&
                    Number.class.isAssignableFrom(sourceType)) {
                return new Double(((Number)obj).doubleValue());
                // TODO: maybe return obj directly if it's a Double            
} else if ((targetType == Float.TYPE || targetType == Float.class) &&
                    Number.class.isAssignableFrom(sourceType)) {
                return new Float(((Number)obj).floatValue());
            }

sourceType=java.lang.String
targetType=java.lang.Double

Because of Number.class.isAssignableFrom(sourceType) returning false (which
makes sense because String.class is not assignable to Double.class), it is
skipping this line. Do we need this extra check?

The RPC parameter stack
===================
Request string: {"service":"MyService","meth
od":"calculatePrice","id":7,"params":[{"item":"ABC","price":"1"}],"server_data":null}

Do you have any idea how to fix this?/

Thank you.
Kanugula.

Andreas Junghans wrote:
> 
> Hi,
> 
> Am 23.02.2008 um 17:17 schrieb kanugula:
> 
>> Some of the fields can be null on the server side.  In order to  
>> make this to
>> work I need to exclude nullable fields in the javascript map as  
>> follows. Can
>> somebody tell me how to build javascript map object dynamically?
>>
>> callRpc("calculatePrice",
>> {item:itemField.getValue(),price:priceField.getValue()});
> 
> How about this:
> 
> var order = {};
> order.item = itemField.getValue();
> var priceString = priceField.getValue();
> if (priceString.length == 0) {
>      order.price = null;
> } else {
>      order.price = parseFloat(priceString);
> }
> rpc.callAsync(myHandler, "calculatePrice", order);
> 
> Regards,
> 
>    Andreas
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-convert-Array-to-Map-literal-tp15653619p15654970.html
Sent from the qooxdoo-devel mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to