public Object stringToValue(String text) throws ParseException { Pattern pattern = getPattern(); if (pattern != null && !TextUtils.isEmpty(text)) { Matcher matcher = pattern.matcher(text); if (matcher.matches()) { return super.stringToValue(text); } throw new ParseException("Pattern did not match", 0); } return text; } }
public Object stringToValue(String string) throws java.text.ParseException { if (string == null) { return super.stringToValue(string); } else { try { return SplashUISupport.stringToBounds(string); } catch (NumberFormatException ex) { throw new java.text.ParseException(string,0); } } }
/** * Parses <code>text</code> returning an arbitrary Object. Some formatters * may return null. * <p> * If a <code>Pattern</code> has been specified and the text completely * matches the regular expression this will invoke <code>setMatcher</code>. * * @throws ParseException * if there is an error in the conversion * @param text * String to convert * @return Object representation of text */ public Object stringToValue(String text) throws ParseException { Pattern pattern = getPattern(); if (pattern != null) { Matcher matcher = pattern.matcher(text); if (matcher.matches()) { setMatcher(matcher); return super.stringToValue(text); } throw new ParseException("Pattern did not match", 0); } return text; } }
/** * Parses <code>text</code> returning an arbitrary Object. Some * formatters may return null. * <p> * If a <code>Pattern</code> has been specified and the text * completely matches the regular expression this will invoke * <code>setMatcher</code>. * * @throws ParseException if there is an error in the conversion * @param text String to convert * @return Object representation of text */ @Override public Object stringToValue(String text) throws ParseException { Pattern pattern = getPattern(); if (pattern != null) { Matcher matcher = pattern.matcher(text); if (matcher.matches()) { setMatcher(matcher); return super.stringToValue(text); } throw new ParseException("Pattern did not match", 0); } return text; } }
/** * Parses <code>text</code> returning an arbitrary Object. Some * formatters may return null. * <p> * If a <code>Pattern</code> has been specified and the text * completely matches the regular expression this will invoke * <code>setMatcher</code>. * * @throws ParseException if there is an error in the conversion * @param text String to convert * @return Object representation of text */ @Override public Object stringToValue(String text) throws ParseException { Pattern pattern = getPattern(); if (pattern != null) { Matcher matcher = pattern.matcher(text); if (matcher.matches()) { setMatcher(matcher); return super.stringToValue(text); } throw new ParseException("Pattern did not match", 0); } return text; } }
@Override public Object stringToValue(String value) throws ParseException { if (getMask() == null || getMask().isEmpty()) { return nullMaskFormatter.stringToValue(value);//value; } else { try { return super.stringToValue(value); } catch (ParseException ex) { throw new ParseException(String.format("%s - is invalid text for %s mask.", value, getMask()), ex.getErrorOffset()); } } } }