@Test public void parse_TRIM() throws ParseException { String entry = " slowo1 | slowo2 "; List<String> expected = Lists.newArrayList("slowo1", "slowo2"); List<String> actual = multiWordFormatter.parse(entry, null); assertEquals(expected, actual); }
@Override public List<String> parse(String source, Locale locale) throws ParseException { if (StringUtils.isBlank(source)) { return Collections.emptyList(); } return Lists.newArrayList(source.trim().split("\\s*\\|\\s*")).stream() .filter(x -> StringUtils.isNotBlank(x)) .collect(Collectors.toList()); }
MultiWordFormatterFactory implements AnnotationFormatterFactory<MultiWordFormat>, Formatter<List<String>> { @Override public List<String> parse(String source, Locale locale) throws ParseException { if (StringUtils.isBlank(source)) { return Collections.emptyList(); } return Lists.newArrayList(source.trim().split("\\s*\\|\\s*")).stream() .filter(x -> StringUtils.isNotBlank(x)) .collect(Collectors.toList()); } }
MultiWordFormatterFactory implements AnnotationFormatterFactory<MultiWordFormat>, Formatter<List<String>> { @Override public List<String> parse(String source, Locale locale) throws ParseException { if (StringUtils.isBlank(source)) { return Collections.emptyList(); } return Lists.newArrayList(source.trim().split("\\s*\\|\\s*")).stream() .filter(x -> StringUtils.isNotBlank(x)) .collect(Collectors.toList()); } MultiWordFormatterFactory(); }
MultiWordFormatterFactory implements AnnotationFormatterFactory<MultiWordFormat>, Formatter<List<String>> { @Override public List<String> parse(String source, Locale locale) throws ParseException { if (StringUtils.isBlank(source)) { return Collections.emptyList(); } return Lists.newArrayList(source.trim().split("\\s*\\|\\s*")).stream() .filter(x -> StringUtils.isNotBlank(x)) .collect(Collectors.toList()); } MultiWordFormatterFactory(); @Override Set<Class<?>> getFieldTypes(); @Override Printer<?> getPrinter(MultiWordFormat annotation, Class<?> fieldType); @Override Parser<?> getParser(MultiWordFormat annotation, Class<?> fieldType); @Override String print(List<String> value, Locale locale); @Override List<String> parse(String source, Locale locale); }
MultiWordFormatterFactory implements AnnotationFormatterFactory<MultiWordFormat>, Formatter<List<String>> { @Override public List<String> parse(String source, Locale locale) throws ParseException { if (StringUtils.isBlank(source)) { return Collections.emptyList(); } return Lists.newArrayList(source.trim().split("\\s*\\|\\s*")).stream() .filter(x -> StringUtils.isNotBlank(x)) .collect(Collectors.toList()); } MultiWordFormatterFactory(); @Override Set<Class<?>> getFieldTypes(); @Override Printer<?> getPrinter(MultiWordFormat annotation, Class<?> fieldType); @Override Parser<?> getParser(MultiWordFormat annotation, Class<?> fieldType); @Override String print(List<String> value, Locale locale); @Override List<String> parse(String source, Locale locale);  }