com.blazebit.persistence.criteria.BlazeCriteriaBuilder Maven / Gradle / Ivy
/*
* Copyright 2014 - 2020 Blazebit.
*
* Licensed 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.
*/
package com.blazebit.persistence.criteria;
import javax.persistence.Tuple;
import javax.persistence.criteria.CollectionJoin;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.Expression;
import javax.persistence.criteria.Join;
import javax.persistence.criteria.ListJoin;
import javax.persistence.criteria.MapJoin;
import javax.persistence.criteria.Path;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import javax.persistence.criteria.SetJoin;
import java.util.Map;
/**
* An extended version of {@link CriteriaBuilder}.
*
* @author Christian Beikov
* @since 1.2.0
*/
public interface BlazeCriteriaBuilder extends CriteriaBuilder {
/**
* Create a predicate that tests whether a map is empty.
*
* @param map expression
* @param map type
* @return is-empty predicate
*/
public > Predicate isMapEmpty(Expression map);
/**
* Create a predicate that tests whether a map is not empty.
*
* @param map expression
* @param map type
* @return is-not-empty predicate
*/
public > Predicate isMapNotEmpty(Expression map);
/**
* Create an expression that tests the size of a map.
*
* @param map map
* @param map type
* @return size expression
*/
public > Expression mapSize(Expression map);
/**
* Create an expression that tests the size of a map.
*
* @param map map
* @param map type
* @return size expression
*/
public > Expression mapSize(C map);
/**
* Like {@link CriteriaBuilder#asc(Expression)} but allows to also specify the null precedence.
*
* @param x The expression used to define the ordering
* @param nullsFirst True if nulls should be first, false otherwise
* @return ascending ordering corresponding to the expression
*/
public BlazeOrder asc(Expression x, boolean nullsFirst);
/**
* Like {@link CriteriaBuilder#desc(Expression)} but allows to also specify the null precedence.
*
* @param x The expression used to define the ordering
* @param nullsFirst True if nulls should be first, false otherwise
* @return descending ordering corresponding to the expression
*/
public BlazeOrder desc(Expression x, boolean nullsFirst);
/**
* Like {@link BlazeCriteriaBuilder#createCriteriaUpdate(Class)} but also sets the alias for the entity.
*
* @param targetEntity target type for update operation
* @param alias The alias for the entity
* @param The type of the entity
* @return the query object
*/
public BlazeCriteriaUpdate createCriteriaUpdate(Class targetEntity, String alias);
/**
* Like {@link BlazeCriteriaBuilder#createCriteriaDelete(Class)} but also sets the alias for the entity.
*
* @param targetEntity target type for delete operation
* @param alias The alias for the entity
* @param The type of the entity
* @return the query object
*/
public BlazeCriteriaDelete createCriteriaDelete(Class targetEntity, String alias);
/* covariant overrides */
@Override
public BlazeOrder asc(Expression x);
@Override
public BlazeOrder desc(Expression x);
@Override
public BlazeCriteriaQuery