Class QueryFactory
- java.lang.Object
-
- com.github.longdt.vertxorm.repository.query.QueryFactory
-
public class QueryFactory extends Object
QueryFactory class.
- Version:
- $Id: $Id
- Author:
- Long Dinh
-
-
Field Summary
Fields Modifier and Type Field Description static TupleEMPTY_PARAMSConstantEMPTY_PARAMS
-
Constructor Summary
Constructors Constructor Description QueryFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <O> Query<O>all()Creates a query which matches all objects in the collection.
This is equivalent to a literal boolean 'true'.static <E> And<E>and(Query<E> query1, Query<E> query2)Creates anAndquery, representing a logical AND on child queries, which when evaluated yields the set intersection of the result sets from child queries.static <E> And<E>and(Query<E> query1, Query<E> query2, Query<E>... additionalQueries)Creates anAndquery, representing a logical AND on child queries, which when evaluated yields the set intersection of the result sets from child queries.static <E> And<E>and(Query<E> query1, Query<E> query2, Collection<Query<E>> additionalQueries)Creates anAndquery, representing a logical AND on child queries, which when evaluated yields the set intersection of the result sets from child queries.static <O> Order<O>ascending(String fieldName)ascending.static <O,A extends Comparable<A>>
Between<O,A>between(String fieldName, A lowerValue, A upperValue)Creates aBetweenquery which asserts that an attribute is between a lower and an upper bound, inclusive.static <O> Like<O>contains(String fieldName, String value)Creates aLikequery which asserts that an attribute contains with a certain string fragment.static <O> Order<O>descending(String fieldName)descending.static TupleemptyParams()emptyParams.static <E> Query<E>emptyQuery()emptyQuery.static <O> Like<O>endsWith(String fieldName, String value)Creates aLikequery which asserts that an attribute ends with a certain string fragment.static <E> Equal<E>equal(String fieldName, Object value)equal.static <O,A extends Comparable<A>>
GreaterThan<O,A>greaterThan(String fieldName, A value)Creates aLessThanquery which asserts that an attribute is greater than (but not equal to) a lower bound (i.e.static <O,A extends Comparable<A>>
GreaterThanEqual<O,A>greaterThanOrEqualTo(String fieldName, A value)Creates aGreaterThanquery which asserts that an attribute is greater than or equal to a lower bound (i.e.static <O> Has<O>has(String fieldName)has.static <O> ILike<O>ilike(String fieldName, String value)Creates aILikequery which asserts that an attribute contains with a certain string fragment.static <O,A>
Query<O>in(String attribute, A... attributeValues)Creates aInquery which asserts that an attribute has at least one value matching any value in a set of values.static <O,A>
Query<O>in(String attribute, List<A> attributeValues)Creates aInquery which asserts that an attribute has at least one value matching any value in a set of values.static <O> Query<O>isContainedIn(String fieldName, String value)Creates aQueryquery which asserts that an attribute is contained in a certain string fragment.static <O> IsNull<O>isNull(String fieldName)isNull.static <O,A extends Comparable<A>>
LessThan<O,A>lessThan(String fieldName, A value)Creates aLessThanquery which asserts that an attribute is less than (but not equal to) an upper bound (i.e.static <O,A extends Comparable<A>>
LessThanEqual<O,A>lessThanOrEqualTo(String fieldName, A value)Creates aLessThanEqualquery which asserts that an attribute is less than or equal to an upper bound (i.e.static <O> Like<O>like(String fieldName, String value)Creates aLikequery which asserts that an attribute contains with a certain string fragment.static <O> Query<O>none()Creates a query which matches no objects in the collection.
This is equivalent to a literal boolean 'false'.static <O> Not<O>not(Query<O> query)Creates aNotquery, representing a logical negation of a child query, which when evaluated yields the set complement of the result set from the child query.static <E> NotEqual<E>notEqual(String fieldName, Object value)notEqual.static <O> Or<O>or(Query<O> query1, Query<O> query2)Creates anOrquery, representing a logical OR on child queries, which when evaluated yields the set union of the result sets from child queries.static <O> Or<O>or(Query<O> query1, Query<O> query2, Query<O>... additionalQueries)Creates anOrquery, representing a logical OR on child queries, which when evaluated yields the set union of the result sets from child queries.static <O> Or<O>or(Query<O> query1, Query<O> query2, Collection<Query<O>> additionalQueries)Creates anOrquery, representing a logical OR on child queries, which when evaluated yields the set union of the result sets from child queries.static <O> RawQuery<O>raw(String querySql)raw.static <O> RawQuery<O>raw(String querySql, Object... params)raw.static <O> Like<O>startsWith(String fieldName, String value)Creates aLikequery which asserts that an attribute starts with a certain string fragment.
-
-
-
Field Detail
-
EMPTY_PARAMS
public static final Tuple EMPTY_PARAMS
ConstantEMPTY_PARAMS
-
-
Method Detail
-
lessThanOrEqualTo
public static <O,A extends Comparable<A>> LessThanEqual<O,A> lessThanOrEqualTo(String fieldName, A value)
Creates aLessThanEqualquery which asserts that an attribute is less than or equal to an upper bound (i.e. less than, inclusive).- Type Parameters:
O- The type of the object containing the attributeA- The type of attribute- Parameters:
fieldName- The attribute to which the query refersvalue- The upper bound to be asserted by the query- Returns:
- A
LessThanquery
-
lessThan
public static <O,A extends Comparable<A>> LessThan<O,A> lessThan(String fieldName, A value)
Creates aLessThanquery which asserts that an attribute is less than (but not equal to) an upper bound (i.e. less than, exclusive).- Type Parameters:
O- The type of the object containing the attributeA- The type of attribute- Parameters:
fieldName- The attribute to which the query refersvalue- The upper bound to be asserted by the query- Returns:
- A
LessThanquery
-
greaterThanOrEqualTo
public static <O,A extends Comparable<A>> GreaterThanEqual<O,A> greaterThanOrEqualTo(String fieldName, A value)
Creates aGreaterThanquery which asserts that an attribute is greater than or equal to a lower bound (i.e. greater than, inclusive).- Type Parameters:
O- The type of the object containing the attributeA- The type of attribute- Parameters:
fieldName- The attribute to which the query refersvalue- The lower bound to be asserted by the query- Returns:
- A
GreaterThanquery
-
greaterThan
public static <O,A extends Comparable<A>> GreaterThan<O,A> greaterThan(String fieldName, A value)
Creates aLessThanquery which asserts that an attribute is greater than (but not equal to) a lower bound (i.e. greater than, exclusive).- Type Parameters:
O- The type of the object containing the attributeA- The type of attribute- Parameters:
fieldName- The attribute to which the query refersvalue- The lower bound to be asserted by the query- Returns:
- A
GreaterThanquery
-
and
public static <E> And<E> and(Query<E> query1, Query<E> query2)
Creates anAndquery, representing a logical AND on child queries, which when evaluated yields the set intersection of the result sets from child queries.- Type Parameters:
E- The type of the object containing attributes to which child queries refer- Parameters:
query1- The first child query to be connected via a logical ANDquery2- The second child query to be connected via a logical AND- Returns:
- An
Andquery, representing a logical AND on child queries
-
and
public static <E> And<E> and(Query<E> query1, Query<E> query2, Query<E>... additionalQueries)
Creates anAndquery, representing a logical AND on child queries, which when evaluated yields the set intersection of the result sets from child queries.- Type Parameters:
E- The type of the object containing attributes to which child queries refer- Parameters:
query1- The first child query to be connected via a logical ANDquery2- The second child query to be connected via a logical ANDadditionalQueries- Additional child queries to be connected via a logical AND- Returns:
- An
Andquery, representing a logical AND on child queries
-
and
public static <E> And<E> and(Query<E> query1, Query<E> query2, Collection<Query<E>> additionalQueries)
Creates anAndquery, representing a logical AND on child queries, which when evaluated yields the set intersection of the result sets from child queries.- Type Parameters:
E- The type of the object containing attributes to which child queries refer- Parameters:
query1- The first child query to be connected via a logical ANDquery2- The second child query to be connected via a logical ANDadditionalQueries- Additional child queries to be connected via a logical AND- Returns:
- An
Andquery, representing a logical AND on child queries
-
or
public static <O> Or<O> or(Query<O> query1, Query<O> query2)
Creates anOrquery, representing a logical OR on child queries, which when evaluated yields the set union of the result sets from child queries.- Type Parameters:
O- The type of the object containing attributes to which child queries refer- Parameters:
query1- The first child query to be connected via a logical ORquery2- The second child query to be connected via a logical OR- Returns:
- An
Orquery, representing a logical OR on child queries
-
or
public static <O> Or<O> or(Query<O> query1, Query<O> query2, Query<O>... additionalQueries)
Creates anOrquery, representing a logical OR on child queries, which when evaluated yields the set union of the result sets from child queries.- Type Parameters:
O- The type of the object containing attributes to which child queries refer- Parameters:
query1- The first child query to be connected via a logical ORquery2- The second child query to be connected via a logical ORadditionalQueries- Additional child queries to be connected via a logical OR- Returns:
- An
Orquery, representing a logical OR on child queries
-
or
public static <O> Or<O> or(Query<O> query1, Query<O> query2, Collection<Query<O>> additionalQueries)
Creates anOrquery, representing a logical OR on child queries, which when evaluated yields the set union of the result sets from child queries.- Type Parameters:
O- The type of the object containing attributes to which child queries refer- Parameters:
query1- The first child query to be connected via a logical ORquery2- The second child query to be connected via a logical ORadditionalQueries- Additional child queries to be connected via a logical OR- Returns:
- An
Orquery, representing a logical OR on child queries
-
not
public static <O> Not<O> not(Query<O> query)
Creates aNotquery, representing a logical negation of a child query, which when evaluated yields the set complement of the result set from the child query.- Type Parameters:
O- The type of the object containing attributes to which child queries refer- Parameters:
query- The child query to be logically negated- Returns:
- A
Notquery, representing a logical negation of a child query
-
in
public static <O,A> Query<O> in(String attribute, A... attributeValues)
Creates a
Inquery which asserts that an attribute has at least one value matching any value in a set of values.- Type Parameters:
A- The type of the attributeO- The type of the object containing the attribute- Parameters:
attribute- The attribute to which the query refersattributeValues- The set of values to match- Returns:
- An
Inquery
-
in
public static <O,A> Query<O> in(String attribute, List<A> attributeValues)
Creates a
Inquery which asserts that an attribute has at least one value matching any value in a set of values.- Type Parameters:
A- The type of the attributeO- The type of the object containing the attribute- Parameters:
attribute- The attribute to which the query refersattributeValues- TThe set of values to match- Returns:
- An
Inquery
-
none
public static <O> Query<O> none()
Creates a query which matches no objects in the collection.
This is equivalent to a literal boolean 'false'.- Type Parameters:
O- The type of the objects in the collection- Returns:
- A query which matches no objects in the collection
-
all
public static <O> Query<O> all()
Creates a query which matches all objects in the collection.
This is equivalent to a literal boolean 'true'.- Type Parameters:
O- The type of the objects in the collection- Returns:
- A query which matches all objects in the collection
-
startsWith
public static <O> Like<O> startsWith(String fieldName, String value)
Creates aLikequery which asserts that an attribute starts with a certain string fragment.- Type Parameters:
O- The type of the object containing the attribute- Parameters:
fieldName- The attribute to which the query refersvalue- The value to be asserted by the query- Returns:
- An
Likequery
-
endsWith
public static <O> Like<O> endsWith(String fieldName, String value)
Creates aLikequery which asserts that an attribute ends with a certain string fragment.- Type Parameters:
O- The type of the object containing the attribute- Parameters:
fieldName- The attribute to which the query refersvalue- The value to be asserted by the query- Returns:
- An
Likequery
-
contains
public static <O> Like<O> contains(String fieldName, String value)
Creates aLikequery which asserts that an attribute contains with a certain string fragment.- Type Parameters:
O- The type of the object containing the attribute- Parameters:
fieldName- The attribute to which the query refersvalue- The value to be asserted by the query- Returns:
- An
Likequery
-
like
public static <O> Like<O> like(String fieldName, String value)
Creates aLikequery which asserts that an attribute contains with a certain string fragment.- Type Parameters:
O- The type of the object containing the attribute- Parameters:
fieldName- The attribute to which the query refersvalue- The value to be asserted by the query- Returns:
- An
Likequery
-
ilike
public static <O> ILike<O> ilike(String fieldName, String value)
Creates aILikequery which asserts that an attribute contains with a certain string fragment.- Type Parameters:
O- The type of the object containing the attribute- Parameters:
fieldName- The attribute to which the query refersvalue- The value to be asserted by the query- Returns:
- An
ILikequery
-
isContainedIn
public static <O> Query<O> isContainedIn(String fieldName, String value)
Creates aQueryquery which asserts that an attribute is contained in a certain string fragment.- Type Parameters:
O- The type of the object containing the attribute- Parameters:
fieldName- The attribute to which the query refersvalue- The value to be asserted by the query- Returns:
- An
Queryquery
-
between
public static <O,A extends Comparable<A>> Between<O,A> between(String fieldName, A lowerValue, A upperValue)
Creates aBetweenquery which asserts that an attribute is between a lower and an upper bound, inclusive.- Type Parameters:
O- The type of the object containing the attributeA- The type of attribute- Parameters:
fieldName- The attribute to which the query referslowerValue- The lower bound to be asserted by the queryupperValue- The upper bound to be asserted by the query- Returns:
- A
GreaterThanquery
-
-