/* * Hibernate, Relational Persistence for Idiomatic Java * * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. */ package org.hibernate.query.criteria.internal.predicate; import java.io.Serializable; import java.util.List; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Selection; import org.hibernate.query.criteria.internal.CriteriaBuilderImpl; import org.hibernate.query.criteria.internal.expression.ExpressionImpl; /** * Basic template support for {@link Predicate} implementors providing * expression handling, negation and conjunction/disjunction handling. * * @author Steve Ebersole */ public abstract class AbstractPredicateImpl extends ExpressionImpl<Boolean> implements PredicateImplementor, Serializable { protected AbstractPredicateImpl(CriteriaBuilderImpl criteriaBuilder) { super( criteriaBuilder, Boolean.class ); } public boolean isNegated() { return false; } public Predicate not() { return new NegatedPredicateWrapper( this ); } // Selection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @Override public final boolean isCompoundSelection() { // Should always be false for predicates return super.isCompoundSelection(); } @Override public final List<Selection<?>> getCompoundSelectionItems() { // Should never have sub selection items for predicates return super.getCompoundSelectionItems(); } }