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

com.github.alittlehuang.data.query.specification.WhereClause Maven / Gradle / Ivy

package com.github.alittlehuang.data.query.specification;

import javax.persistence.criteria.Predicate;
import java.util.List;

/**
 * @author ALittleHuang
 */
public interface WhereClause {

    List> getCompoundItems();

    Expression getExpression();

    Object getParameter();

    Predicate.BooleanOperator getBooleanOperator();

    boolean isCompound();

    ConditionalOperator getConditionalOperator();

    boolean isNegate();

    static boolean isEmpty(WhereClause whereClause) {
        if ( whereClause.isCompound() ) {
            List> compoundItems = whereClause.getCompoundItems();
            if ( compoundItems != null ) {
                for ( WhereClause item : compoundItems ) {
                    if ( !isEmpty(item) ) {
                        return false;
                    }
                }
            }
            return true;
        } else {
            return whereClause.getExpression() == null;
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy