/** * @return The {@link #getBuildCode()}s of all our children */ protected String getChildBuildCodes() { StringBuilder builder = new StringBuilder(); for (OutboundVariable child : children) { builder.append(child.getBuildCode()); } return builder.toString(); }
/** * @return The {@link #getDeclareCode()}s of all our children */ protected String getChildDeclareCodes() { StringBuilder builder = new StringBuilder(); for (OutboundVariable child : children) { builder.append(child.getDeclareCode()); } return builder.toString(); }
buffer.append(ov.getDeclareCode()); buffer.append(ov.getBuildCode()); String assignCode = ov.getAssignCode(); if (assignCode == null)
public OutboundVariable convertOutbound(Object object, OutboundContext outctx) throws MarshallException { if (object == null) { return new SimpleOutboundVariable("null", outctx, true); } // Check to see if we have done this one already OutboundVariable ov = outctx.get(object); 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(object); if (converter == null) { log.error(Messages.getString("DefaultConverterManager.MissingConverter", object.getClass().getName())); return new SimpleOutboundVariable("null", outctx, true); } return converter.convertOutbound(object, outctx); }
public String getAssignCode() { if (isInline()) { StringBuffer buffer = new StringBuffer(); buffer.append("["); boolean first = true; for (OutboundVariable child : getChildren()) { if (!first) { buffer.append(','); } buffer.append(child.getAssignCode()); first = false; } buffer.append("]"); return buffer.toString(); } else { return getVariableName(); } } }
@Override public OutboundVariable convertOutbound(Object paramObject, OutboundContext paramOutboundContext) throws MarshallException { //Convert from Unit to String // Check to see if we have done this one already OutboundVariable ov = paramOutboundContext.get(paramObject); if (ov != null) { // So the object as been converted already, we just need to refer to it. return ov.getReferenceVariable(); } if(paramObject instanceof Unit<?>){ Unit<?> unit = (Unit<?>)paramObject; String unitString = UnitUtil.formatLocal(unit); if(unit == unit.ONE) unitString = "ONE"; return new SimpleOutboundVariable("'" + unitString + "';",paramOutboundContext,false); }else{ throw new MarshallException(paramObject.getClass()); } }
OutboundVariable nested = entry.getValue(); String nestedAssignCode = nested.getAssignCode();
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); }
public String getBuildCode() { if (isInline()) { return getChildBuildCodes(); } else { StringBuffer buffer = new StringBuffer(getChildBuildCodes()); int i = 0; String variableName = getVariableName(); for (OutboundVariable child : getChildren()) { if (child != null) { buffer.append(variableName); buffer.append('['); buffer.append(i); buffer.append("]="); buffer.append(child.getAssignCode()); buffer.append(';'); } i++; } buffer.append("\r\n"); return buffer.toString(); } }
OutboundVariable nested = entry.getValue(); String innerAssignCode = nested.getAssignCode();