@Test public void mailTest() { PatternCorrector pc = new PatternCorrector(Patterns.MAIL_ADDRESS); assertNotNull(pc.correct("chennan@ctrip.com")); assertNull(pc.correct("chennan")); assertNull(pc.correct("@")); assertNull(pc.correct("ctrip.com")); assertNull(pc.correct("@ctrip.com")); assertNull(pc.correct(null)); assertNull(pc.correct("")); assertNull(pc.correct(" ")); }
@Override public String correct(String value) { if (Strings.isNullOrEmpty(value)) return null; Matcher matcher = _pattern.matcher(value); if (matcher.matches()) return value; else return null; }
PatternCorrector implements ValueCorrector<String> { @Override public String correct(String value) { if (Strings.isNullOrEmpty(value)) return null; Matcher matcher = _pattern.matcher(value); if (matcher.matches()) return value; else return null; } }
PatternCorrector implements ValueCorrector<String> { @Override public String correct(String value) { if (Strings.isNullOrEmpty(value)) return null; Matcher matcher = _pattern.matcher(value); if (matcher.matches()) return value; else return null; } PatternCorrector(Pattern pattern); }
PatternCorrector implements ValueCorrector<String> { @Override public String correct(String value) { if (Strings.isNullOrEmpty(value)) return null; Matcher matcher = _pattern.matcher(value); if (matcher.matches()) return value; else return null; } PatternCorrector(Pattern pattern); @Override String correct(String value); }
PatternCorrector implements ValueCorrector<String> { @Override public String correct(String value) { if (Strings.isNullOrEmpty(value)) return null; Matcher matcher = _pattern.matcher(value); if (matcher.matches()) return value; else return null; } PatternCorrector(Pattern pattern); @Override String correct(String value);  }