All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.mikesafonov.specification.builder.starter.predicates.GreaterThanPredicateBuilder Maven / Gradle / Ivy

There is a newer version: 1.10.0
Show newest version
package com.github.mikesafonov.specification.builder.starter.predicates;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.Expression;
import javax.persistence.criteria.Predicate;

/**
 *
 * @author MikeSafonov
 */
public class GreaterThanPredicateBuilder extends SimplePredicateBuilder {

    private final CriteriaBuilder cb;
    private final Object fieldValue;

    public GreaterThanPredicateBuilder(CriteriaBuilder cb, Object fieldValue, Expression expression) {
        super(expression);
        this.cb = cb;
        this.fieldValue = fieldValue;
    }

    @Override
    public Predicate build() {
        return cb.greaterThan(expression, (Comparable) fieldValue);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy