Package org.directwebremoting.extend

Examples of org.directwebremoting.extend.ObjectOutboundVariable


        if (ovs == null)
        {
            ovs = new HashMap<String, OutboundVariable>();
        }

        ObjectOutboundVariable ov = new ObjectOutboundVariable(outctx);
        outctx.put(data, ov);

        // Loop through the map outputting any init code and collecting
        // converted outbound variables into the ovs map
        Map<Object, Object> map = (Map<Object, Object>) data;
        for (Entry<Object, Object> entry : map.entrySet())
        {
            Object key = entry.getKey();
            Object value = entry.getValue();

            // If the key is null, retrieve the configured null key value from the configuration of this converter.
            if (null == key && null != nullKey) {
                log.debug("MapConverter: A null key was encountered DWR is using the configured nullKey string: " + nullKey);
                key = nullKey;
            }

            // It would be nice to check for Enums here
            if (!(key instanceof String) && !sentNonStringWarning)
            {
                log.warn("--Javascript does not support non string keys. Converting '" + key.getClass().getName() + "' using toString()");
                sentNonStringWarning = true;
            }

            String outkey = JavascriptUtil.escapeJavaScript(key.toString());

            /*
            OutboundVariable ovkey = converterManager.convertOutbound(key, outctx);
            buffer.append(ovkey.getInitCode());
            outkey = ovkey.getAssignCode();
            */

            OutboundVariable nested = converterManager.convertOutbound(value, outctx);

            ovs.put(outkey, nested);
        }

        ov.setChildren(ovs);

        return ov;
    }
View Full Code Here


    {
        // Where we collect out converted children
        Map<String, OutboundVariable> ovs = new TreeMap<String, OutboundVariable>();

        // We need to do this before collecting the children to save recursion
        ObjectOutboundVariable ov = new ObjectOutboundVariable(outctx, data.getClass(), getJavascript());
        outctx.put(data, ov);

        try
        {
            Map<String, Property> properties = getPropertyMapFromObject(data, true, false);
            for (Entry<String, Property> entry : properties.entrySet())
            {
                String name = entry.getKey();
                Property property = entry.getValue();

                Object value = property.getValue(data);
                OutboundVariable nested = getConverterManager().convertOutbound(value, outctx);

                ovs.put(name, nested);
            }
        }
        catch (ConversionException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            throw new ConversionException(data.getClass(), ex);
        }

        ov.setChildren(ovs);

        return ov;
    }
View Full Code Here

TOP

Related Classes of org.directwebremoting.extend.ObjectOutboundVariable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.