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

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

There is a newer version: 6.0-6
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.persistence.criteria;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import javax.persistence.Tuple;


public interface CriteriaBuilder {

    CriteriaQuery createQuery();

     CriteriaQuery createQuery(Class resultClass);

    CriteriaQuery createTupleQuery();

     CompoundSelection construct(Class resultClass, Selection... selections);

    CompoundSelection tuple(Selection... selections);

    CompoundSelection array(Selection... selections);

    Order asc(Expression x);

    Order desc(Expression x);

     Expression avg(Expression x);

     Expression sum(Expression x);

    Expression sumAsLong(Expression x);

    Expression sumAsDouble(Expression x);

     Expression max(Expression x);

     Expression min(Expression x);

    > Expression greatest(Expression x);
    > Expression least(Expression x);

    Expression count(Expression x);

    Expression countDistinct(Expression x);

    Predicate exists(Subquery subquery);

     Expression all(Subquery subquery);

     Expression some(Subquery subquery);

     Expression any(Subquery subquery);

    Predicate and(Expression x, Expression y);

    Predicate and(Predicate... restrictions);

    Predicate or(Expression x, Expression y);

    Predicate or(Predicate... restrictions);

    Predicate not(Expression restriction);

    Predicate conjunction();

    Predicate disjunction();

    Predicate isTrue(Expression x);

    Predicate isFalse(Expression x);

    Predicate isNull(Expression x);

    Predicate isNotNull(Expression x);

    Predicate equal(Expression x, Expression y);

    Predicate equal(Expression x, Object y);

    Predicate notEqual(Expression x, Expression y);

    Predicate notEqual(Expression x, Object y);

    > Predicate greaterThan(Expression x, Expression y);

    > Predicate greaterThan(Expression x, Y y);

    > Predicate greaterThanOrEqualTo(Expression x, Expression y);

    > Predicate greaterThanOrEqualTo(Expression x, Y y);

    > Predicate lessThan(Expression x, Expression y);

    > Predicate lessThan(Expression x, Y y);

    > Predicate lessThanOrEqualTo(Expression x, Expression y);

    > Predicate lessThanOrEqualTo(Expression x, Y y);

    > Predicate between(Expression v, Expression x, Expression y);

    > Predicate between(Expression v, Y x, Y y);

    Predicate gt(Expression x, Expression y);

    Predicate gt(Expression x, Number y);

    Predicate ge(Expression x, Expression y);

    Predicate ge(Expression x, Number y);

    Predicate lt(Expression x, Expression y);

    Predicate lt(Expression x, Number y);

    Predicate le(Expression x, Expression y);

    Predicate le(Expression x, Number y);

     Expression neg(Expression x);

     Expression abs(Expression x);

     Expression sum(Expression x, Expression y);

     Expression sum(Expression x, N y);

     Expression sum(N x, Expression y);

     Expression prod(Expression x, Expression y);

     Expression prod(Expression x, N y);

     Expression prod(N x, Expression y);

     Expression diff(Expression x, Expression y);

     Expression diff(Expression x, N y);

     Expression diff(N x, Expression y);

    Expression quot(Expression x, Expression y);

    Expression quot(Expression x, Number y);

    Expression quot(Number x, Expression y);

    Expression mod(Expression x, Expression y);

    Expression mod(Expression x, Integer y);

    Expression mod(Integer x, Expression y);

    Expression sqrt(Expression x);

    Expression toLong(Expression number);

    Expression toInteger(Expression number);

    Expression toFloat(Expression number);

    Expression toDouble(Expression number);

    Expression toBigDecimal(Expression number);

    Expression toBigInteger(Expression number);

    Expression toString(Expression character);

     Expression literal(T value);

     Expression nullLiteral(Class resultClass);

     ParameterExpression parameter(Class paramClass);

     ParameterExpression parameter(Class paramClass, String name);

    > Predicate isEmpty(Expression collection);

    > Predicate isNotEmpty(Expression collection);

    > Expression size(Expression collection);

    > Expression size(C collection);

    > Predicate isMember(Expression elem, Expression collection);

    > Predicate isMember(E elem, Expression collection);

    > Predicate isNotMember(Expression elem, Expression collection);

    > Predicate isNotMember(E elem, Expression collection);

    > Expression> values(M map);

    > Expression> keys(M map);

    Predicate like(Expression x, Expression pattern);

    Predicate like(Expression x, String pattern);

    Predicate like(Expression x, Expression pattern, Expression escapeChar);

    Predicate like(Expression x, Expression pattern, char escapeChar);

    Predicate like(Expression x, String pattern, Expression escapeChar);

    Predicate like(Expression x, String pattern, char escapeChar);

    Predicate notLike(Expression x, Expression pattern);

    Predicate notLike(Expression x, String pattern);

    Predicate notLike(Expression x, Expression pattern, Expression escapeChar);

    Predicate notLike(Expression x, Expression pattern, char escapeChar);

    Predicate notLike(Expression x, String pattern, Expression escapeChar);

    Predicate notLike(Expression x, String pattern, char escapeChar);

    Expression concat(Expression x, Expression y);

    Expression concat(Expression x, String y);

    Expression concat(String x, Expression y);

    Expression substring(Expression x, Expression from);

    Expression substring(Expression x, int from);

    Expression substring(Expression x, Expression from, Expression len);

    Expression substring(Expression x, int from, int len);

    public static enum Trimspec { 

        LEADING,
        TRAILING, 

        BOTH 
    }

    Expression trim(Expression x);

    Expression trim(Trimspec ts, Expression x);

    Expression trim(Expression t, Expression x);

    Expression trim(Trimspec ts, Expression t, Expression x);

    Expression trim(char t, Expression x);

    Expression trim(Trimspec ts, char t, Expression x);

    Expression lower(Expression x);

    Expression upper(Expression x);

    Expression length(Expression x);

    Expression locate(Expression x, Expression pattern);

    Expression locate(Expression x, String pattern);

    Expression locate(Expression x, Expression pattern, Expression from);

    Expression locate(Expression x, String pattern, int from);

    Expression currentDate();

    Expression currentTimestamp();

    Expression currentTime();

    public static interface In extends Predicate {

         Expression getExpression();
         In value(T value);

         In value(Expression value);
     }

     In in(Expression expression);

     Expression coalesce(Expression x, Expression y);

     Expression coalesce(Expression x, Y y);

     Expression nullif(Expression x, Expression y);

     Expression nullif(Expression x, Y y);

    public static interface Coalesce extends Expression {

         Coalesce value(T value);

         Coalesce value(Expression value);
    }
     Coalesce coalesce();

    public static interface SimpleCase extends Expression {

        Expression getExpression();

        SimpleCase when(C condition, R result);

        SimpleCase when(C condition, Expression result);

        Expression otherwise(R result);

        Expression otherwise(Expression result);
    }

     SimpleCase selectCase(Expression expression);

    public static interface Case extends Expression {

        Case when(Expression condition, R result);

        Case when(Expression condition, Expression result);

        Expression otherwise(R result);

        Expression otherwise(Expression result);
    }

     Case selectCase();

    Expression function(String name, Class type, Expression... args);

}