Search in sources :

Example 1 with CriterionLimit

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;
}
Also used : CriterionLimit(io.vertigo.dynamo.criteria.CriterionLimit) Serializable(java.io.Serializable) Predicate(java.util.function.Predicate)

Aggregations

CriterionLimit (io.vertigo.dynamo.criteria.CriterionLimit)1 Serializable (java.io.Serializable)1 Predicate (java.util.function.Predicate)1