use of io.vertigo.dynamo.criteria.CriterionLimit in project vertigo by KleeGroup.
the class DtListPatternFilterUtil method createDtListRangeFilter.
private static <D extends DtObject> Predicate<D> createDtListRangeFilter(final String[] parsedFilter, final String fieldName, final DataType dataType) {
final boolean minIncluded = "[".equals(parsedFilter[2]);
final Serializable minValue = convertToValue(parsedFilter[3], dataType, true);
final Serializable maxValue = convertToValue(parsedFilter[4], dataType, true);
final boolean maxIncluded = "]".equals(parsedFilter[5]);
final CriterionLimit min = minIncluded ? CriterionLimit.ofIncluded(minValue) : CriterionLimit.ofExcluded(minValue);
final CriterionLimit max = maxIncluded ? CriterionLimit.ofIncluded(maxValue) : CriterionLimit.ofExcluded(maxValue);
final Predicate predicate = Criterions.isBetween(() -> fieldName, min, max).toPredicate();
return predicate;
}
Aggregations