public Paging<T> convert() { if (this.result == null || result.getList().isEmpty()) { return this.result; } int index = 0; for (T bean : result.getList()) { S source = this.paging.get(index); ConverterContext.convert(bean, source); index++; } return this.result; }
@Override public Object objectFromString(iWidget widget, String value, Object context) { if (context == TITLECASE_CONTEXT) { value = ((value == null) || (value.length() == 0)) ? value : perThreadCharArray.get().set(value).toTitleCase().toString(); } else if (context == TITLECASE_CLEAN_CONTEXT) { if ((value != null) && (value.length() > 0)) { CharArray ca = perThreadCharArray.get(); try { CharScanner.cleanQuoted(value, ca); } catch (ParseException ex) { ca.set(value); } value = ca.toTitleCase().toString(); } } else if ((context != null) && ((ConverterContext) context).getName().equals("html")) { String style = (String) ((ConverterContext) context).getUserObject(); if (value == null) { return (style == null) ? null : "<html></html>"; } return (style == null) ? "<html>" + value + "</html>" : "<html>" + style + value + "</html>"; } else if (context == CAPITALIZE_CONTEXT) { value = ((value == null) || (value.length() == 0)) ? value : perThreadCharArray.get().set(value).toTitleCase().toString(); } else if (context == CAPITALIZE_CLEAN_CONTEXT) { if ((value != null) && (value.length() > 0)) { CharArray ca = perThreadCharArray.get(); try { CharScanner.cleanQuoted(value, ca); } catch (ParseException ex) { ca.set(value); } ca.toLowerCase(); ca.A[0] = Character.toUpperCase(ca.A[0]); value = ca.toString(); } } else if ((context instanceof ConverterContext) && (context != PASSWORD_CONTEXT)) { ConverterContext sc = (ConverterContext) context; try { value = CharScanner.cleanQuoted(value); } catch (ParseException e) { Platform.ignoreException(null, e); } if (sc == RESOURCE_CONTEXT) { String s = widget.getAppContext().getResourceAsString(value); if ((s != null) && (s.length() > 0)) { value = s; } } else if (sc != EXPANDER_CONTEXT) { String format = sc.getName(); if ((format != null) && (format.indexOf("%s") != -1)) { value = PlatformHelper.format(format, value); int min = (minValue instanceof Number) ? ((Number) minValue).intValue() : -1; int max = (maxValue instanceof Number) ? ((Number) maxValue).intValue() : Integer.MAX_VALUE; if ((value.length() < min) || (value.length() > max)) { throw new FormatException(Utils.makeInvalidRangeString(min, max)); } } } } return value; }