public OutboundVariable convertOutbound(Object data, OutboundContext outctx) { return new NonNestedOutboundVariable("null"); } }
public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws ConversionException { // TODO: Do we ever actually convert this? Looking at the methods, I // can't believe we do. // Context context = (Context) data; return new NonNestedOutboundVariable(/*context.getContextPath()*/null); } }
public OutboundVariable convertOutbound(Object data, OutboundContext outctx) { return new NonNestedOutboundVariable("null"); } }
public OutboundVariable convertOutbound(Object data, OutboundContext outctx) { if (data == null) { return new NonNestedOutboundVariable("null"); } return new NonNestedOutboundVariable(data.toString()); }
public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws ConversionException { return new NonNestedOutboundVariable('\"' + data.toString() + '\"'); }
public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws ConversionException { return new NonNestedOutboundVariable(data.toString()); } }
public OutboundVariable convertOutbound(Object data, OutboundContext outctx) { return new NonNestedOutboundVariable('\'' + data.toString() + '\''); } }
public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws ConversionException { // We don't actually need to cast to RawData, but we want to make sure // that that's was we've really been given RawData raw = (RawData) data; return new NonNestedOutboundVariable(raw.toString()); } }
public OutboundVariable convertOutbound(Object data, OutboundContext outctx) { return new NonNestedOutboundVariable('"' + ((Enum<?>) data).name() + '"'); } }
public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws ConversionException { return new NonNestedOutboundVariable('\"' + ((Currency) data).getCurrencyCode() + '\"'); }
public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws ConversionException { URI uri = (URI) data; String escaped = JavascriptUtil.escapeJavaScript(uri.toString()); return new NonNestedOutboundVariable('\"' + escaped + '\"'); }
public OutboundVariable getReferenceVariable() { if (reference == null) { reference = new NonNestedOutboundVariable(getVariableName()); } referenced = true; return reference; }
public OutboundVariable convertOutbound(Object data, OutboundContext outctx) { return new NonNestedOutboundVariable('\'' + JavascriptUtil.escapeJavaScript(data.toString()) + '\''); } }
public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws ConversionException { URL url = (URL) data; String escaped = JavascriptUtil.escapeJavaScript(url.toExternalForm()); return new NonNestedOutboundVariable('\"' + escaped + '\"'); }
public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws ConversionException { String output = new String((char[]) data); String escaped = JavascriptUtil.escapeJavaScript(output); return new NonNestedOutboundVariable('\"' + escaped + '\"'); } }
public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws ConversionException { String escaped = JavascriptUtil.escapeJavaScript(data.toString(), false); return new NonNestedOutboundVariable('\"' + escaped + '\"'); } }
public OutboundVariable convertOutbound(Object data, OutboundContext outctx) { Class<?> paramType = data.getClass(); if (data.equals(Boolean.TRUE)) { return new NonNestedOutboundVariable("true"); } else if (data.equals(Boolean.FALSE)) { return new NonNestedOutboundVariable("false"); } else if (paramType == Character.class) { // Treat characters as strings return new NonNestedOutboundVariable('\"' + JavascriptUtil.escapeJavaScript(data.toString()) + '\"'); } else { // We just use the default toString for all numbers return new NonNestedOutboundVariable(data.toString()); } }
public OutboundVariable convertOutbound(Object data, OutboundContext outboundContext) throws ConversionException { long milliSeconds; if (data instanceof DateTime) { DateTime dateTime = (DateTime) data; milliSeconds = dateTime.getMillis(); } else if (data instanceof LocalDateTime) { LocalDateTime date = (LocalDateTime) data; milliSeconds = date.toDateTime().toDate().getTime(); } else { throw new ConversionException(data.getClass()); } return new NonNestedOutboundVariable("new Date(" + milliSeconds + ")"); } }
public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws ConversionException { long millis; if (data instanceof Calendar) { Calendar cal = (Calendar) data; millis = cal.getTime().getTime(); } else if (data instanceof Date) { Date date = (Date) data; millis = date.getTime(); } else { throw new ConversionException(data.getClass()); } return new NonNestedOutboundVariable("new Date(" + millis + ")"); } }
public OutboundVariable convertOutbound(Object data, OutboundContext converted) throws ConversionException { if (data == null) { return new NonNestedOutboundVariable("null"); } // Check to see if we have done this one already if (!converted.isJsonMode()) { OutboundVariable ov = converted.get(data); if (ov != null) { // So the object as been converted already, we just need to refer to it. return ov.getReferenceVariable(); } } // So we will have to do the conversion Converter converter = getConverter(data); if (converter == null) { String message = "No outbound converter found for '" + data.getClass().getName() + "'"; log.error(message); return new ErrorOutboundVariable(message); } return converter.convertOutbound(data, converted); }