@Override public Object stringToValue(String text) throws ParseException { Number value = (Number) numberFormatter.stringToValue(text); if (value.intValue() < minValue) { throw new ParseException("Value cannot be less than "+minValue, 0); } return value; }
@Override public Object stringToValue(String text) throws ParseException { // RU locale (and others) requires a non-breaking space for a grouping separator text = text.replace(' ', '\u00a0'); return super.stringToValue(text); }
/** * Returns the <code>Object</code> representation of the * <code>String</code> <code>text</code>.<p> * * Unlike its superclass, this class converts blank strings * to the empty value. * * @param text <code>String</code> to convert * @return <code>Object</code> representation of text * @throws ParseException if there is an error in the conversion */ @Override public Object stringToValue(String text) throws ParseException { return ValidationUtils.isBlank(text) ? emptyValue : super.stringToValue(text); }
@Override public Object stringToValue(String text) throws ParseException { Object o = null; try { o = super.stringToValue(text); } catch (ParseException e) { boolean throwException = true; if (e.getMessage().equals("Value not within min/max range")) { final int value = ((Number)getFormat().parseObject(text)).intValue(); if (value < minValue) { o = Integer.valueOf(minValue); throwException = false; } else if (value > maxValue) { o = Integer.valueOf(maxValue); throwException = false; } } if (throwException) { throw e; } } return o; } }
retVal = super.stringToValue(text);
return super.stringToValue(aText);
value = (Number) super.stringToValue(getNumberFormat() != null ? getNumberFormat().format(value.toString()) : value.toString()); // needed? value = (Number) super.stringToValue(text); // will throw a ParseException
value = (Number) super.stringToValue(getNumberFormat() != null ? getNumberFormat().format(value.toString()) : value.toString()); // needed? value = (Number) super.stringToValue(text); // will throw a ParseException