}
else {
results = Collections.singletonList(status.result);
}
FormattingChain formatters = new FormattingChain();
if (includeFormatting == true) {
// Get formatter objects regarding the Attributes format and
// encoding
// format Attribute
formatters.addFormatter(new TagOutputFormatter(status.format, getTMLContext(), stringToBoolean(getTrim())));
// Encode the result regarding the encode attribute
String encodersList = getStatus().encode;
if (encodersList != null && !encodersList.equals("none")) {
Iterator encoders = WGUtils.deserializeCollection(encodersList, ",", true).iterator();
while (encoders.hasNext()) {
String encoder = (String) encoders.next();
try {
ObjectFormatter formatter = getCore().getEncodingFormatter(encoder, getTMLContext());
formatters.addFormatter(formatter);
}
catch (FormattingException e) {
addWarning("No encoding formatter registered under encoding key '" + encoder + "'");
}
}
}
}
// Get a string from it. Serialize if it is a collection. Format output
String result = de.innovationgate.utils.WGUtils.serializeCollection(results, (includeFormatting ? status.divider : ""), formatters);
// Set formatting errors as warnings
Iterator errors = formatters.getErrors().iterator();
while (errors.hasNext()) {
FormattingException e = (FormattingException) errors.next();
addWarning("Formatting/Encoding error: " + WGUtils.getRootCause(e).getMessage());
}