Search in sources :

Example 21 with OutboundVariable

use of org.directwebremoting.extend.OutboundVariable in project ma-core-public by infiniteautomation.

the class ObjectOutboundVariable method getInlineDefinition.

/* (non-Javadoc)
     * @see org.directwebremoting.dwrp.AbstractOutboundVariable#getInlineDefinition()
     */
protected String getInlineDefinition() {
    StringBuffer buffer = new StringBuffer();
    buffer.append('{');
    boolean first = true;
    for (Iterator it = ovs.entrySet().iterator(); it.hasNext(); ) {
        Map.Entry entry = (Map.Entry) it.next();
        String name = (String) entry.getKey();
        OutboundVariable nested = (OutboundVariable) entry.getValue();
        String innerAssignCode = nested.getAssignCode();
        if (!first) {
            buffer.append(',');
        }
        // and when we are not recursive
        if (LocalUtil.isSimpleName(name)) {
            buffer.append(name);
            buffer.append(':');
            buffer.append(innerAssignCode);
        } else {
            buffer.append('\'');
            buffer.append(name);
            buffer.append("\':");
            buffer.append(innerAssignCode);
        }
        // we don't need to do this one the hard way
        first = false;
    }
    buffer.append('}');
    return buffer.toString();
}
Also used : OutboundVariable(org.directwebremoting.extend.OutboundVariable) Iterator(java.util.Iterator) Map(java.util.Map)

Aggregations

OutboundVariable (org.directwebremoting.extend.OutboundVariable)21 MarshallException (org.directwebremoting.extend.MarshallException)12 Iterator (java.util.Iterator)10 Map (java.util.Map)7 ObjectOutboundVariable (org.directwebremoting.dwrp.ObjectOutboundVariable)6 SimpleOutboundVariable (org.directwebremoting.dwrp.SimpleOutboundVariable)6 TreeMap (java.util.TreeMap)5 Property (org.directwebremoting.extend.Property)5 StringWriter (java.io.StringWriter)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 ArrayOutboundVariable (org.directwebremoting.dwrp.ArrayOutboundVariable)2 ErrorOutboundVariable (org.directwebremoting.dwrp.ErrorOutboundVariable)2 Converter (org.directwebremoting.extend.Converter)2 NamedConverter (org.directwebremoting.extend.NamedConverter)2 Collection (java.util.Collection)1 Entry (java.util.Map.Entry)1 Unit (javax.measure.unit.Unit)1 Source (javax.xml.transform.Source)1