@Test public void getDelimiters() { predicate.set("delimiter", ","); predicate.set("0_delimiter", "?"); predicate.set("1_delimiter", "/"); predicate.set("2_delimiter", "\\"); predicate.set("_delimiter", "no"); predicate.set("incorrect", "no"); predicate.set("1_incorrect", "no"); List<String> actual = propertyValuesPredicateEvaluator.getDelimiters(predicate); assertEquals(4, actual.size()); assertTrue(actual.contains(Pattern.quote(","))); assertTrue(actual.contains(Pattern.quote("?"))); assertTrue(actual.contains(Pattern.quote("/"))); assertTrue(actual.contains(Pattern.quote("\\"))); assertFalse(actual.contains("no")); }
protected List<String> getDelimiters(final Predicate predicate) { final List<String> delimiterValues = PredicateEvaluatorUtil.getValues(predicate, DELIMITER, true); if (delimiterValues.stream().anyMatch(DELIMITER_CODE_NONE::equals)) { return emptyList(); } final List<String> delimiters = delimiterValues.stream() .map(this::resolveDelimiter) .filter(Objects::nonNull) .collect(Collectors.toList()); if (delimiters.isEmpty() && cfg.delimiters_default() != null) { return Stream.of(cfg.delimiters_default()).map(Pattern::quote).collect(Collectors.toList()); } else { return delimiters; } }
PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected List<String> getDelimiters(final Predicate predicate) { final List<String> delimiterValues = PredicateEvaluatorUtil.getValues(predicate, DELIMITER, true); if (delimiterValues.stream().anyMatch(DELIMITER_CODE_NONE::equals)) { return emptyList(); } final List<String> delimiters = delimiterValues.stream() .map(this::resolveDelimiter) .filter(Objects::nonNull) .collect(Collectors.toList()); if (delimiters.isEmpty() && cfg.delimiters_default() != null) { return Stream.of(cfg.delimiters_default()).map(Pattern::quote).collect(Collectors.toList()); } else { return delimiters; } } }
PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected List<String> getDelimiters(final Predicate predicate) { final List<String> delimiterValues = PredicateEvaluatorUtil.getValues(predicate, DELIMITER, true); if (delimiterValues.stream().anyMatch(DELIMITER_CODE_NONE::equals)) { return emptyList(); } final List<String> delimiters = delimiterValues.stream() .map(this::resolveDelimiter) .filter(Objects::nonNull) .collect(Collectors.toList()); if (delimiters.isEmpty() && cfg.delimiters_default() != null) { return Stream.of(cfg.delimiters_default()).map(Pattern::quote).collect(Collectors.toList()); } else { return delimiters; } }  }
PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected List<String> getDelimiters(final Predicate predicate) { final List<String> delimiterValues = PredicateEvaluatorUtil.getValues(predicate, DELIMITER, true); if (delimiterValues.stream().anyMatch(DELIMITER_CODE_NONE::equals)) { return emptyList(); } final List<String> delimiters = delimiterValues.stream() .map(this::resolveDelimiter) .filter(Objects::nonNull) .collect(Collectors.toList()); if (delimiters.isEmpty() && cfg.delimiters_default() != null) { return Stream.of(cfg.delimiters_default()).map(Pattern::quote).collect(Collectors.toList()); } else { return delimiters; } }  @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> getDelimiters(final Predicate predicate) { final List<String> delimiterValues = PredicateEvaluatorUtil.getValues(predicate, DELIMITER, true); if (delimiterValues.stream().anyMatch(DELIMITER_CODE_NONE::equals)) { return emptyList(); } final List<String> delimiters = delimiterValues.stream() .map(this::resolveDelimiter) .filter(Objects::nonNull) .collect(Collectors.toList()); if (delimiters.isEmpty() && cfg.delimiters_default() != null) { return Stream.of(cfg.delimiters_default()).map(Pattern::quote).collect(Collectors.toList()); } else { return delimiters; } }  @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; }