private Formatter findFormatterFor(Class<?> type) { for (Formatter formatter : this.formatters) { if (formatter.isResponsibleFor(type)) { return formatter; } } return null; }
if(found.isStateless())
if(found.isStateless())
@SuppressWarnings({"unchecked"}) protected Object formatAsString(MessageContext messageContext, Object value) { if (value == null) { return null; } if (value instanceof String) { return value; } if (messageContext.config().getFormatterFactory() != null) { Formatter formatter = messageContext.config().getFormatterFactory().findFormatter(value.getClass()); if (formatter != null) { return formatter.format(messageContext, value); } } if (value instanceof Localizable) { return ((Localizable) value).toString(messageContext); } return value; } }
private Formatter findFormatterFor(Class<?> type) { for (Formatter formatter : this.formatters) { if (formatter.isResponsibleFor(type)) { return formatter; } } return null; }
@SuppressWarnings({"unchecked"}) protected Object formatAsString(MessageContext messageContext, Object value) { if (value == null) { return null; } if (value instanceof String) { return value; } if (messageContext.config().getFormatterFactory() != null) { Formatter formatter = messageContext.config().getFormatterFactory().findFormatter(value.getClass()); if (formatter != null) { return formatter.format(messageContext, value); } } if (value instanceof Localizable) { return ((Localizable) value).toString(messageContext); } return value; } }