@Override public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws MarshallException { final QName name = (QName) data; // // Where we collect out converted children final Map<String, OutboundVariable> ovs = new TreeMap<String, OutboundVariable>(); // We need to do this before collecing the children to save recurrsion final ObjectOutboundVariable ov = new ObjectOutboundVariable(outctx); outctx.put(data, ov); if (!StringUtils.isEmpty(name.getNamespaceURI())) { ovs.put("namespaceURI", getConverterManager() //$NON-NLS-1$ .convertOutbound(name.getNamespaceURI(), outctx)); } ovs.put("localPart", getConverterManager().convertOutbound(name.getLocalPart(), outctx)); //$NON-NLS-1$ if (!StringUtils.isEmpty(name.getPrefix())) { ovs.put("prefix", getConverterManager().convertOutbound(name.getPrefix(), outctx)); //$NON-NLS-1$ } ov.init(ovs, null); return ov; }
public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws ConversionException { if (!data.getClass().isArray()) { throw new ConversionException(data.getClass()); } ArrayOutboundVariable ov = new ArrayOutboundVariable(outctx); outctx.put(data, ov); // Convert all the data members int size = Array.getLength(data); List<OutboundVariable> ovs = new ArrayList<OutboundVariable>(); for (int i = 0; i < size; i++) { OutboundVariable nested; try { nested = converterManager.convertOutbound(Array.get(data, i), outctx); } catch (Exception ex) { String errorMessage = "Conversion error for " + data.getClass().getName() + "."; log.warn(errorMessage, ex); nested = new ErrorOutboundVariable(errorMessage); } ovs.add(nested); } // Group the list of converted objects into this OutboundVariable ov.setChildren(ovs); return ov; }
outctx.put(data, ov);
outctx.put(data, ov);
@Override public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws MarshallException { final JAXBElement<?> element = (JAXBElement<?>) data; // // Where we collect out converted children final Map<String, OutboundVariable> ovs = new TreeMap<String, OutboundVariable>(); // We need to do this before collecing the children to save recurrsion final ObjectOutboundVariable ov = new ObjectOutboundVariable(outctx); outctx.put(data, ov); ovs.put("name", getConverterManager().convertOutbound(element.getName(), outctx)); //$NON-NLS-1$ ovs.put("value", getConverterManager().convertOutbound(element.getValue(), outctx)); //$NON-NLS-1$ ov.init(ovs, null); return ov; }
outctx.put(data, ov);
public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws ConversionException { // 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; }
outctx.put(data, ov);
outctx.put(data, ov);
@Override public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws MarshallException { @SuppressWarnings("unchecked") final G coordinateInfo = (G) data; final C coordinates = createCoordinates(coordinateInfo); // // Where we collect out converted children final Map<String, OutboundVariable> ovs = new TreeMap<String, OutboundVariable>(); // We need to do this before collecing the children to save recurrsion final ObjectOutboundVariable ov = new ObjectOutboundVariable(outctx); outctx.put(data, ov); ovs.put("type", getConverterManager().convertOutbound(getGeometryType(), outctx)); //$NON-NLS-1$ ovs.put("coordinates", getConverterManager().convertOutbound(coordinates, outctx)); //$NON-NLS-1$ ov.init(ovs, null); return ov; }
@Override public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws MarshallException { @SuppressWarnings("unchecked") final G coordinateInfo = (G) data; final C coordinates = createCoordinates(coordinateInfo); // // Where we collect out converted children final Map<String, OutboundVariable> ovs = new TreeMap<String, OutboundVariable>(); // We need to do this before collecing the children to save recurrsion final ObjectOutboundVariable ov = new ObjectOutboundVariable(outctx); outctx.put(data, ov); ovs.put("type", getConverterManager().convertOutbound(getGeometryType(), outctx)); //$NON-NLS-1$ ovs.put("coordinates", getConverterManager().convertOutbound(coordinates, outctx)); //$NON-NLS-1$ ov.init(ovs, null); return ov; } // @Override
outctx.put(data, ov);