Package org.infinispan.objectfilter.impl.hql.predicate

Source Code of org.infinispan.objectfilter.impl.hql.predicate.FilterRangePredicate

package org.infinispan.objectfilter.impl.hql.predicate;

import org.hibernate.hql.ast.spi.predicate.RangePredicate;
import org.infinispan.objectfilter.impl.syntax.AndExpr;
import org.infinispan.objectfilter.impl.syntax.BooleanExpr;
import org.infinispan.objectfilter.impl.syntax.ComparisonExpr;
import org.infinispan.objectfilter.impl.syntax.ConstantValueExpr;
import org.infinispan.objectfilter.impl.syntax.PropertyValueExpr;

/**
* @author anistor@redhat.com
* @since 7.0
*/
class FilterRangePredicate extends RangePredicate<BooleanExpr> {

   public FilterRangePredicate(String propertyName, Object lower, Object upper) {
      super(propertyName, lower, upper);
   }

   @Override
   public BooleanExpr getQuery() {
      return new AndExpr(
            new ComparisonExpr(new PropertyValueExpr(propertyName), new ConstantValueExpr((Comparable) lower), ComparisonExpr.Type.GREATER_OR_EQUAL),
            new ComparisonExpr(new PropertyValueExpr(propertyName), new ConstantValueExpr((Comparable) upper), ComparisonExpr.Type.LESS_OR_EQUAL)
      );
   }
}
TOP

Related Classes of org.infinispan.objectfilter.impl.hql.predicate.FilterRangePredicate

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.