org.kie.internal.query.ParametrizedQueryBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kie-internal Show documentation
Show all versions of kie-internal Show documentation
The Drools and jBPM internal API which is NOT backwards compatible between releases.
/*
* Copyright 2015 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* 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 org.kie.internal.query;
/**
* This is the base interface for all {@link ParametrizedQueryBuilder} implementations.
*
* It includes the basic query functions.
*
* @param The type of {@link ParametrizedQueryBuilder} instance being implemented. This type
* is here to facilitate the building of a fluent interface.
*/
public interface ParametrizedQueryBuilder {
/**
* Synonym for {@link #or()}
*
* Query criteria which are added to the query after this method
* are "OR" or "union" criteria.
*
* Since this is based on SQL, please remember that intersection operands
* have precedence over union operands.
*
* In other words,
* A or B and C == A or (B and C)
* A and B or C == (A and B) or C
*
*
* This is the default mode for all query builders.
* @return the current query builder instance
*/
public T union();
/**
* Synonym for {@link #union()}
*
* Query criteria which are added to the query after this method
* are "OR" or "union" criteria.
*
* Since this is based on SQL, please remember that intersection operands
* have precedence over union operands.
*
* In other words,
* A or B and C == A or (B and C)
* A and B or C == (A and B) or C
*
*
* This is the default mode for all query builders.
* @return the current query builder instance
*/
public T or();
/**
* Synonym for {@link #and()}
*
* Query criteria which are added to the query after this method
* are "AND" or "intersection" criteria.
*
* Since this is based on SQL, please remember that intersection operands
* have precedence over union operands.
*
* In other words,
* A or B and C == A or (B and C)
* A and B or C == (A and B) or C
*
*
* @return the current query builder instance
*/
public T intersect();
/**
* Synonym for {@link #intersect()}
*
* Query criteria which are added to the query after this method
* are "AND" or "intersection" criteria.
*
* Since this is based on SQL, please remember that intersection operands
* have precedence over union operands.
*
* In other words,
* A or B and C == A or (B and C)
* A and B or C == (A and B) or C
*
*
* @return the current query builder instance
*/
public T and();
/**
* Query criteria which are added to the query after this method
* are regular expression (a.k.a "regex") criteria. In other words,
* the query will return results which match the regular expressions
* specified.
*
* Only String criteria may be added after using this method. In order
* to go back to adding normal or non-regex criteria, use the {@link #equals()}
* method.
*
* The following characters may be used:
* - .
* - This character matches any single character.
*
* - *
* - This character matches zero or more characters.
*
*
*
* @deprecated will be deleted in 7.0
* @see {@code #regex()}
* @return the current query builder instance
*/
@Deprecated
public T like();
/**
* Query criteria which are added to the query after this method
* are regular expression (a.k.a "regex") criteria. In other words,
* the query will return results which match the regular expressions
* specified.
*
* Only String criteria may be added after using this method. In order
* to go back to adding normal or non-regex criteria, use the {@link #equals()}
* method.
*
* The following characters may be used:
* - .
* - This character matches any single character.
*
* - *
* - This character matches zero or more characters.
*
*
*
* @see {@code #like()}
* @return the current query builder instance
*/
public T regex();
/**
* Results retrieved using query criteria added after this method
* is used, must exactly match the criteria given.
*
* If the {@link #like()} method has been used, using this method
* will ensure that criteria added after this method are literally
* interpreted, and not seen as regular expressions.
*
* This is the default mode for all query builders.
* @return the current query builder instance
*/
public T equals();
/**
* Clear all parameters and meta-criteria
* @return the current query builder instance
*/
public T clear();
/**
* Limit the number of results returned by the query to the specified maximum.
* @param maxResults The maximum number of results to return
*
* @return the current query builder instance
*/
public T maxResults(int maxResults);
/**
* Limit the results returned by excluding the specified number of results (the offset),
* from the start of the result list.
*
* Which results are excluded (offset) is dependent on the order of the results returned.
* See the orderBy(enum) methods as well as {@link #ascending()} and {@link #descending()}.
* @param offset The number of elements skipped before the first element in the result
* @return the current query builder instance
*/
public T offset(int offset);
}