/** * @see org.apache.wicket.util.convert.IConverter#convertToString(java.lang.Object, * java.util.Locale) */ public String convertToString(Object value, Locale locale) { if (value == null || "".equals(value)) { return ""; } return (String)Objects.convertValue(value, String.class); } }
/** * @see org.apache.wicket.util.convert.IConverter#convertToObject(java.lang.String, * java.util.Locale) */ public Object convertToObject(String value, Locale locale) { if (value == null) { return null; } if ("".equals(value)) { if (((Class)type.get()) == String.class) { return ""; } return null; } try { return Objects.convertValue(value, (Class)type.get()); } catch (Exception e) { throw new ConversionException(e.getMessage(), e).setSourceValue(value); } }
C converted = Objects.convertValue(value, theType); if (converted != null)
@Override public String convertToString(C value, Locale locale) { if (value == null || "".equals(value)) { return ""; } try { return Objects.convertValue(value, String.class); } catch (RuntimeException e) { throw new ConversionException("Could not convert object of type: " + value.getClass() + " to String. Possible its #toString() returned null. " + "Either install a custom converter (see IConverterLocator) or " + "override #toString() to return a non-null value.", e).setSourceValue(value) .setConverter(this); } } }
@Override public String convertToString(C value, Locale locale) { if (value == null || "".equals(value)) { return ""; } try { return Objects.convertValue(value, String.class); } catch (RuntimeException e) { throw new ConversionException("Could not convert object of type: " + value.getClass() + " to String. Possible its #toString() returned null. " + "Either install a custom converter (see IConverterLocator) or " + "override #toString() to return a non-null value.", e).setSourceValue(value) .setConverter(this); } } }
C converted = Objects.convertValue(value, theType); if (converted != null)
/** * @see org.apache.wicket.util.convert.IConverter#convertToString(java.lang.Object, * java.util.Locale) */ public String convertToString(Object value, Locale locale) { if (value == null || "".equals(value)) { return ""; } try { return (String)Objects.convertValue(value, String.class); } catch (Exception e) { throw new ConversionException("Could not convert object of type: " + value.getClass() + " to string. Possible its #toString() returned null. " + "Either install a custom converter (see IConverterLocator) or " + "override #toString() to return a non-null value.", e).setSourceValue(value) .setConverter(this); } } }
Object converted = Objects.convertValue(value, theType); if (theType.isAssignableFrom(converted.getClass()))
try result = Objects.convertValue(object, clz);
for (int i = 0, icount = Array.getLength(value); i < icount; i++) Array.set(result, i, convertValue(Array.get(value, i), componentType));
for (int i = 0, icount = Array.getLength(value); i < icount; i++) Array.set(result, i, convertValue(Array.get(value, i), componentType));
return Objects.convertValue(object, clz);
return Objects.convertValue(object, clz);
for (int i = 0, icount = Array.getLength(value); i < icount; i++) Array.set(result, i, convertValue(Array.get(value, i), componentType));
try result = Objects.convertValue(object, clz);