struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maurizio Cucchiara <maurizio.cucchi...@gmail.com>
Subject Re: JSON plugin suggest : parse String value "" to Number with null / 0
Date Wed, 24 Nov 2010 16:43:25 GMT
2010/11/24 Martin Gainty <mgainty@hotmail.com>

> if the <target> attribute is available in object acquired by
> invocation.getAction() then you should see the target
>
> does this answer your question?
>

Actually, It doesn't.
I meant that conversion methods like convertPrimitive (see the code below)
 use to take class type and value as argument and they always try to
understand the kind of type they're facing, choosing by value (for this
reason I called "value driven"). Why don't they choose conversion by type
destination?


private Object convertPrimitive(Class clazz, Object value, Method method)
throws JSONException {
        if (value == null) {
            if (Short.TYPE.equals(clazz) || Short.class.equals(clazz))
                return (short) 0;
            ...
        } else if (value instanceof Number) {
            Number number = (Number) value;


-- 
Maurizio Cucchiara

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message