@Test public void getValues() { List<String> expected = new ArrayList<>(); expected.add("one"); expected.add("two"); expected.add("three"); List<String> delimiters = new ArrayList<>(); delimiters.add(","); List<String> actual = propertyValuesPredicateEvaluator.getValues("one,two,three", delimiters); assertEquals(expected, actual); }
protected List<String> getValues(final String data, final List<String> delimiters) { if (delimiters.size() == 0) { return ImmutableList.<String>builder().add(data).build(); } final String regex = delimiters.stream() .filter(StringUtils::isNotBlank) .collect(Collectors.joining("|")); final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE); if (data == null) { return Collections.emptyList(); } return Arrays.stream(pattern.split(data)) .map(StringUtils::trimToNull) .filter(Objects::nonNull) .collect(Collectors.toList()); }
PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected List<String> getValues(final String data, final List<String> delimiters) { if (delimiters.size() == 0) { return ImmutableList.<String>builder().add(data).build(); } final String regex = delimiters.stream() .filter(StringUtils::isNotBlank) .collect(Collectors.joining("|")); final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE); if (data == null) { return Collections.emptyList(); } return Arrays.stream(pattern.split(data)) .map(StringUtils::trimToNull) .filter(Objects::nonNull) .collect(Collectors.toList()); } }
PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected List<String> getValues(final String data, final List<String> delimiters) { if (delimiters.size() == 0) { return ImmutableList.<String>builder().add(data).build(); } final String regex = delimiters.stream() .filter(StringUtils::isNotBlank) .collect(Collectors.joining("|")); final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE); if (data == null) { return Collections.emptyList(); } return Arrays.stream(pattern.split(data)) .map(StringUtils::trimToNull) .filter(Objects::nonNull) .collect(Collectors.toList()); }  }
PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected List<String> getValues(final String data, final List<String> delimiters) { if (delimiters.size() == 0) { return ImmutableList.<String>builder().add(data).build(); } final String regex = delimiters.stream() .filter(StringUtils::isNotBlank) .collect(Collectors.joining("|")); final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE); if (data == null) { return Collections.emptyList(); } return Arrays.stream(pattern.split(data)) .map(StringUtils::trimToNull) .filter(Objects::nonNull) .collect(Collectors.toList()); }  @Override String getXPathExpression(Predicate predicate, EvaluationContext evaluationContext); @Override boolean includes(final Predicate predicate, final Row row, final EvaluationContext evaluationContext); @Override boolean canXpath(final Predicate predicate, final EvaluationContext evaluationContext); @Override boolean canFilter(final Predicate predicate, final EvaluationContext evaluationContext); @Override boolean isFiltering(final Predicate predicate, final EvaluationContext evaluationContext); @Override String[] getOrderByProperties(Predicate predicate, EvaluationContext evaluationContext); @Override Comparator<Row> getOrderByComparator(Predicate predicate, EvaluationContext evaluationContext); @Override FacetExtractor getFacetExtractor(Predicate predicate, EvaluationContext evaluationContext); }
PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected List<String> getValues(final String data, final List<String> delimiters) { if (delimiters.size() == 0) { return ImmutableList.<String>builder().add(data).build(); } final String regex = delimiters.stream() .filter(StringUtils::isNotBlank) .collect(Collectors.joining("|")); final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE); if (data == null) { return Collections.emptyList(); } return Arrays.stream(pattern.split(data)) .map(StringUtils::trimToNull) .filter(Objects::nonNull) .collect(Collectors.toList()); }  @Override String getXPathExpression(Predicate predicate, EvaluationContext evaluationContext); @Override boolean includes(final Predicate predicate, final Row row, final EvaluationContext evaluationContext); @Override boolean canXpath(final Predicate predicate, final EvaluationContext evaluationContext); @Override boolean canFilter(final Predicate predicate, final EvaluationContext evaluationContext); @Override boolean isFiltering(final Predicate predicate, final EvaluationContext evaluationContext); @Override String[] getOrderByProperties(Predicate predicate, EvaluationContext evaluationContext); @Override Comparator<Row> getOrderByComparator(Predicate predicate, EvaluationContext evaluationContext); @Override FacetExtractor getFacetExtractor(Predicate predicate, EvaluationContext evaluationContext); static final String PREDICATE_NAME; static final String VALUES; }