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

javax.persistence.criteria.CriteriaBuilder Maven / Gradle / Ivy

/*
 * Copyright (c) 1998-2018 Caucho Technology -- all rights reserved
 *
 * This file is part of Resin(R) Open Source
 *
 * Each copy or derived work must preserve the copyright notice and this
 * notice unmodified.
 *
 * Resin Open Source is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Resin Open Source is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
 * of NON-INFRINGEMENT.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Resin Open Source; if not, write to the
 *
 *   Free Software Foundation, Inc.
 *   59 Temple Place, Suite 330
 *   Boston, MA 02111-1307  USA
 *
 * @author Scott Ferguson
 */

package javax.persistence.criteria;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.persistence.Tuple;

/**
 * Interface to build criteria.
 *
 * @since JPA 2.0
 */
public interface CriteriaBuilder {
  public enum Trimspec {
    BOTH,
    LEADING,
    TRAILING
  }
  
  public CriteriaQuery createQuery();
  
  public  CriteriaQuery createQuery(Class resultClass);
  
  public CriteriaQuery createTupleQuery();
  
  public  CompoundSelection construct(Class resultClass,
                                            Selection ...selections);
  
  public CompoundSelection tuple(Selection... selections);
  
  public CompoundSelection array(Selection... selections);
  
  public Order asc(Expression x);
  
  public Order desc(Expression x);
  
  public  Expression avg(Expression x);
  
  public  Expression sum(Expression x);
  
  public Expression sumAsLong(Expression x);
  
  public Expression sumAsDouble(Expression x);
  
  public  Expression max(Expression x);
  
  public  Expression min(Expression x);
  
  public > 
  Expression greatest(Expression x);
  
  public > 
  Expression least(Expression x);
  
  public Expression count(Expression x);
  
  public Expression countDistinct(Expression x);
  
  public Predicate exists(Subquery subquery);
  
  public  Expression all(Subquery subquery);
  
  public  Expression some(Subquery subquery);
  
  public  Expression any(Subquery subquery);
  
  public Predicate and(Expression x,
                       Expression y);

  public Predicate and(Predicate... restrictions);
  
  public Predicate or(Expression x,
                      Expression y);

  public Predicate or(Predicate... restrictions);
  
  public Predicate not(Expression restriction);
  
  public Predicate conjunction();

  public Predicate disjunction();
  
  public Predicate isTrue(Expression x);
  
  public Predicate isFalse(Expression x);
  
  public Predicate isNull(Expression x);
  
  public Predicate isNotNull(Expression x);
  
  public Predicate equal(Expression x, Expression y);
  
  public Predicate equal(Expression x, Object y);
  
  public Predicate notEqual(Expression x, Expression y);
  
  public Predicate notEqual(Expression x, Object y);
  
  public >
  Predicate greaterThan(Expression x,
                        Expression y);
  
  public >
  Predicate greaterThan(Expression x,
                        Y y);
  
  public >
  Predicate greaterThanOrEqualTo(Expression x,
                                 Expression y);
  
  public >
  Predicate greaterThanOrEqualTo(Expression x,
                                 Y y);
  
  public >
  Predicate lessThan(Expression x,
                     Expression y);
  
  public >
  Predicate lessThan(Expression x,
                     Y y);
  
  public >
  Predicate lessThanOrEqualTo(Expression x,
                              Expression y);
  
  public >
  Predicate lessThanOrEqualTo(Expression x,
                              Y y);
  
  >
  Predicate between(Expression v,
                    Expression x,
                    Expression y);
  
  >
  Predicate between(Expression v,
                    Y x,
                    Y y);
  
  public Predicate gt(Expression x,
                      Expression y);
  
  public Predicate gt(Expression x,
                      Number y);
  
  public Predicate ge(Expression x,
                      Expression y);
  
  public Predicate ge(Expression x,
                      Number y);
  
  public Predicate lt(Expression x,
                      Expression y);
  
  public Predicate lt(Expression x,
                      Number y);
  
  public Predicate le(Expression x,
                      Expression y);
  
  public Predicate le(Expression x,
                      Number y);
  
  public  Expression neg(Expression x);
  
  public  Expression abs(Expression x);
  
  public  Expression sum(Expression x,
                                              Expression y);
  
  public  Expression sum(Expression x,
                                              N y);
  
  public  Expression sum(N x,
                                              Expression y);
  
  public  Expression prod(Expression x,
                                               Expression y);
  
  public  Expression prod(Expression x,
                                               N y);
  
  public  Expression prod(N x,
                                               Expression y);
  
  public  Expression diff(Expression x,
                                               Expression y);
  
  public  Expression diff(Expression x,
                                               N y);
  
  public  Expression diff(N x,
                                               Expression y);

  public Expression quot(Expression x,
                                 Expression y);

  public Expression quot(Expression x,
                                 Number y);

  public Expression quot(Number x, Expression y);

  public Expression mod(Expression x,
                                 Expression y);
  
  public Expression mod(Expression x,
                                 Integer y);
  
  public Expression mod(Integer x,
                                 Expression y);
  
  public Expression sqrt(Expression x);
  
  public Expression toLong(Expression number);
  
  public Expression toInteger(Expression number);
  
  public Expression toFloat(Expression number);
  
  public Expression toDouble(Expression number);
  
  public Expression toBigDecimal(Expression number);
  
  public Expression toBigInteger(Expression number);
  
  public Expression toString(Expression expr);
  
  public  Expression literal(T value);
  
  public  Expression nullLiteral(Class resultClass);
  
  public  ParameterExpression parameter(Class paramClass);
  
  public  ParameterExpression parameter(Class paramClass, String name);
  
  public >
  Predicate isEmpty(Expression collection);
  
  public >
  Predicate isNotEmpty(Expression collection);

  public >
  Expression size(Expression collection);
  
  public >
  Expression size(C collection);
 
  public >
  Predicate isMember(Expression elem,
                     Expression collection);
  
  public >
  Predicate isMember(E elem,
                     Expression collection);
  
  public >
  Predicate isNotMember(Expression elem,
                        Expression collection);
  
  public >
  Predicate isNotMember(E elem,
                        Expression collection);
  
  public >
  Expression> values(M map);
  
  public >
  Expression> keys(M map);
  
  public Predicate like(Expression x,
                        Expression pattern);
  
  public Predicate like(Expression x,
                        String pattern);
  
  public Predicate like(Expression x,
                        Expression pattern,
                        Expression escapeChar);
  
  public Predicate like(Expression x,
                        Expression pattern,
                        char escapeChar);
  
  public Predicate like(Expression x,
                        String pattern,
                        Expression escapeChar);
  
  public Predicate like(Expression x,
                        String pattern,
                        char escapeChar);
  
  public Predicate notLike(Expression x,
                           Expression pattern);
  
  public Predicate notLike(Expression x,
                           String pattern);
  
  public Predicate notLike(Expression x,
                           Expression pattern,
                           Expression escapeChar);
  
  public Predicate notLike(Expression x,
                           Expression pattern,
                           char escapeChar);
  
  public Predicate notLike(Expression x,
                           String pattern,
                           Expression escapeChar);
  
  public Predicate notLike(Expression x,
                           String pattern,
                           char escapeChar);
  
  public Expression concat(Expression x,
                                   Expression y);
  
  public Expression concat(Expression x,
                                   String y);
  
  public Expression concat(String x,
                                   Expression y);
  
  public Expression substring(Expression x,
                                      Expression from);
  
  public Expression substring(Expression x,
                                      int from);
  
  public Expression substring(Expression x,
                                      Expression from,
                                      Expression len);
  
  public Expression substring(Expression x,
                                      int from,
                                      int len);
  
  public Expression trim(Expression x);
  
  public Expression trim(Trimspec trim,
                                 Expression x);
  
  public Expression trim(Expression t,
                                 Expression x);
  
  public Expression trim(Trimspec trimSpec,
                                 Expression t,
                                 Expression x);
  
  public Expression trim(char t,
                                 Expression x);
  
  public Expression trim(Trimspec trimSpec,
                                 char t,
                                 Expression x);
  
  public Expression lower(Expression x);
  
  public Expression upper(Expression x);
  
  public Expression length(Expression x);
  
  public Expression locate(Expression x,
                                    Expression pattern);
  
  public Expression locate(Expression x,
                                    String pattern);
  
  public Expression locate(Expression x,
                                    Expression pattern,
                                    Expression from);
  
  public Expression locate(Expression x,
                                    String pattern,
                                    int from);
  
  public Expression currentDate();
  
  public Expression currentTimestamp();
  
  public Expression