@Override
protected String encodeImpl(Object source) {
try {
if (source == null)
throw new ConverterException("Parameter cannot be null");
ReadNode readNode = Mapper.getReadClassMapper(source.getClass()).mapObject(source);
if (readNode == null)
throw new ConverterException("Could not read anything from IgnoredEntity. Perhaps it contains an @AccessType(IGNORE) ?");
Map<String, String> values = readNode.getSimpleValues();
XMLBuilder xmlBuilder = new XMLBuilder();
for (String key : values.keySet()) {
xmlBuilder.put(key, values.get(key));
}
return xmlBuilder.getAsString();
}
catch (Exception ex) {
if (ex instanceof ConverterException)
throw (ConverterException)ex;
throw new ConverterException(ex);
}
}