public abstract class QRestrictor<T> extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
QRestrictor(Class<T> baseClass,
QOperation combinator) |
protected |
QRestrictor(ICriteriaTableDef<T> meta,
QOperation combinator) |
protected |
QRestrictor(QRestrictor<T> parent,
QOperation combinator) |
| Modifier and Type | Method and Description |
|---|---|
QRestrictor<T> |
add(QOperatorNode n) |
QRestrictor<T> |
and() |
QRestrictor<T> |
between(String property,
Object a,
Object b)
Compare the value of a property with two literal bounds.
|
<V,R extends QField<R,T>> |
eq(QField<R,V> property,
V value)
Compare a property with some value.
|
<R extends QField<R,T>> |
eq(QFieldDouble<R> property,
double value) |
QRestrictor<T> |
eq(String property,
double value)
Compare a property with some literal object value.
|
QRestrictor<T> |
eq(String property,
long value)
Compare a property with some literal object value.
|
QRestrictor<T> |
eq(String property,
Object value)
Compare a property with some literal object value.
|
<U> QRestrictor<U> |
exists(Class<U> childclass,
String childproperty)
Create a joined "exists" subquery on some child list property.
|
<P extends QField<P,T>,R extends QField<R,U>,U> |
exists(QList<P,R> listProperty) |
QRestrictor<T> |
ge(String property,
double value)
Compare a property with some literal object value.
|
QRestrictor<T> |
ge(String property,
long value)
Compare a property with some literal object value.
|
QRestrictor<T> |
ge(String property,
Object value)
Compare a property with some literal object value.
|
Class<T> |
getBaseClass()
Returns the persistent class being queried and returned, if this is a class-based query.
|
ICriteriaTableDef<T> |
getMetaTable()
Returns the metatable being queried, or null.
|
abstract QOperatorNode |
getRestrictions() |
Class<T> |
getReturnClass()
Return the datatype returned by a principal query using this criteria.
|
Set<QSubQuery<?,?>> |
getUnusedSubquerySet()
Internal method, used to be able to find QSubQueries that were allocated (using
subquery(Class) but not
properly linked back into the main query. |
QRestrictor<T> |
gt(String property,
double value)
Compare a property with some literal object value.
|
QRestrictor<T> |
gt(String property,
long value)
Compare a property with some literal object value.
|
QRestrictor<T> |
gt(String property,
Object value)
Compare a property with some literal object value.
|
boolean |
hasRestrictions()
Returns T if this has restrictions.
|
QRestrictor<T> |
ilike(String property,
Object value)
Do a case-independent 'like' comparison.
|
<V,R extends QField<R,T>> |
in(QField<R,V> property,
List<V> value)
A property must be one of a list of values.
|
<V> QRestrictor<T> |
in(String property,
List<V> inlist)
A property must be one of a list of values.
|
<V> QRestrictor<T> |
in(String property,
QSelection<?> selection) |
protected void |
internalAdd(QOperatorNode r)
Add a new restriction to the list of restrictions on the data.
|
void |
internalUseQuery(QSubQuery<?,?> q)
|
QRestrictor<T> |
isnotnull(String property)
Add the restriction that the property specified must be not-null.
|
QRestrictor<T> |
isnull(String property)
Add the restriction that the property specified must be null.
|
QRestrictor<T> |
le(String property,
double value)
Compare a property with some literal object value.
|
QRestrictor<T> |
le(String property,
long value)
Compare a property with some literal object value.
|
QRestrictor<T> |
le(String property,
Object value)
Compare a property with some literal object value.
|
QRestrictor<T> |
like(String property,
Object value)
Do a 'like' comparison.
|
QRestrictor<T> |
lt(String property,
double value)
Compare a property with some literal object value.
|
QRestrictor<T> |
lt(String property,
long value)
Compare a property with some literal object value.
|
QRestrictor<T> |
lt(String property,
Object value)
Compare a property with some literal object value.
|
void |
mergeCriteria(QRestrictor<T> other)
This merges the "other" restrictor's restrictions inside this restriction.
|
<V,R extends QField<R,T>> |
ne(QField<R,V> property,
V value)
Compare a property with some value.
|
QRestrictor<T> |
ne(String property,
double value)
Compare a property with some literal object value.
|
QRestrictor<T> |
ne(String property,
long value)
Compare a property with some literal object value.
|
QRestrictor<T> |
ne(String property,
Object value)
Compare a property with some literal object value.
|
QRestrictor<T> |
not()
Add NOT restriction.
|
QRestrictor<T> |
or()
Return a thingy that constructs nodes combined with "or".
|
QRestrictor<T> |
or(QOperatorNode a1,
QOperatorNode a2,
QOperatorNode... rest)
Deprecated.
|
abstract void |
setRestrictions(QOperatorNode n) |
QRestrictor<T> |
sqlCondition(String sql)
Add a restriction specified in bare SQL.
|
QRestrictor<T> |
sqlCondition(String sql,
Object[] params)
Add a restriction in bare SQL, with JDBC parameters inside the string (specified as '?').
|
<U> QSubQuery<U,T> |
subquery(Class<U> childClass) |
protected QRestrictor(@Nonnull Class<T> baseClass, @Nonnull QOperation combinator)
protected QRestrictor(@Nonnull ICriteriaTableDef<T> meta, @Nonnull QOperation combinator)
protected QRestrictor(@Nonnull QRestrictor<T> parent, @Nonnull QOperation combinator)
@Nullable public abstract QOperatorNode getRestrictions()
public abstract void setRestrictions(@Nullable QOperatorNode n)
@Nullable public Class<T> getBaseClass()
@Nullable public ICriteriaTableDef<T> getMetaTable()
@Nonnull public Class<T> getReturnClass()
public final boolean hasRestrictions()
protected void internalAdd(@Nonnull QOperatorNode r)
r - @Nonnull public QRestrictor<T> or()
@Nonnull public QRestrictor<T> and()
@Nonnull public QRestrictor<T> not()
public void mergeCriteria(@Nonnull QRestrictor<T> other)
other - @Nonnull public QRestrictor<T> add(@Nonnull QOperatorNode n)
@Nonnull public QRestrictor<T> eq(@Nonnull String property, @Nullable Object value)
property - value - @Nonnull public <V,R extends QField<R,T>> QRestrictor<T> eq(@Nonnull QField<R,V> property, @Nonnull V value)
property - value - @Nonnull public <V,R extends QField<R,T>> QRestrictor<T> ne(@Nonnull QField<R,V> property, @Nonnull V value)
property - value - @Nonnull public QRestrictor<T> eq(@Nonnull String property, long value)
property - value - @Nonnull public QRestrictor<T> eq(@Nonnull String property, double value)
property - value - @Nonnull public QRestrictor<T> ne(@Nonnull String property, @Nullable Object value)
property - value - @Nonnull public QRestrictor<T> ne(@Nonnull String property, long value)
property - value - @Nonnull public QRestrictor<T> ne(@Nonnull String property, double value)
property - value - @Nonnull public <V> QRestrictor<T> in(@Nonnull String property, List<V> inlist)
V - property - inlist - @Nonnull public <V> QRestrictor<T> in(@Nonnull String property, QSelection<?> selection)
@Nonnull public <V,R extends QField<R,T>> QRestrictor<T> in(@Nonnull QField<R,V> property, @Nonnull List<V> value)
@Nonnull public QRestrictor<T> gt(@Nonnull String property, @Nonnull Object value)
property - value - @Nonnull public QRestrictor<T> gt(@Nonnull String property, long value)
property - value - @Nonnull public QRestrictor<T> gt(@Nonnull String property, double value)
property - value - @Nonnull public QRestrictor<T> lt(@Nonnull String property, @Nonnull Object value)
property - value - @Nonnull public QRestrictor<T> lt(@Nonnull String property, long value)
property - value - @Nonnull public QRestrictor<T> lt(@Nonnull String property, double value)
property - value - @Nonnull public QRestrictor<T> ge(@Nonnull String property, @Nonnull Object value)
property - value - @Nonnull public QRestrictor<T> ge(@Nonnull String property, long value)
property - value - @Nonnull public QRestrictor<T> ge(@Nonnull String property, double value)
property - value - @Nonnull public QRestrictor<T> le(@Nonnull String property, @Nonnull Object value)
property - value - @Nonnull public QRestrictor<T> le(@Nonnull String property, long value)
property - value - @Nonnull public QRestrictor<T> le(@Nonnull String property, double value)
property - value - @Nonnull public QRestrictor<T> like(@Nonnull String property, @Nonnull Object value)
property - value - @Nonnull public QRestrictor<T> between(@Nonnull String property, @Nonnull Object a, @Nonnull Object b)
property - a - b - @Nonnull public QRestrictor<T> ilike(@Nonnull String property, @Nonnull Object value)
property - value - @Deprecated @Nonnull public QRestrictor<T> or(@Nonnull QOperatorNode a1, @Nonnull QOperatorNode a2, @Nonnull QOperatorNode... rest)
a - @Nonnull public QRestrictor<T> isnull(@Nonnull String property)
property - @Nonnull public QRestrictor<T> isnotnull(@Nonnull String property)
property - @Nonnull public QRestrictor<T> sqlCondition(@Nonnull String sql)
sql - @Nonnull public QRestrictor<T> sqlCondition(@Nonnull String sql, @Nonnull Object[] params)
sql - params - @Nonnull public <U> QRestrictor<U> exists(@Nonnull Class<U> childclass, @Nonnull String childproperty)
U - The type of the children.childclass - The class type of the children, because Java Generics is too bloody stupid to find out itself.childproperty - The name of the property in the parent class @Nonnull public <P extends QField<P,T>,R extends QField<R,U>,U> QRestrictor<U> exists(@Nonnull QList<P,R> listProperty) throws Exception
Exceptionpublic <R extends QField<R,T>> QRestrictor<T> eq(@Nonnull QFieldDouble<R> property, double value)
public <U> QSubQuery<U,T> subquery(@Nonnull Class<U> childClass) throws Exception
Exceptionpublic Set<QSubQuery<?,?>> getUnusedSubquerySet()
subquery(Class) but not
properly linked back into the main query. That is, if you create a correlated subquery like (select max(date) from xxx where xxx.id=parent.id)
and you do not use that subquery inside the parent (select * from yyy where yyy.date = (subquery)) then
the subquery is "lost". This leads to unexpected results as the user assumes the subquery does something.
Registering all subqueries created here allows any querying visitor to implement a check: it should
remove all subqueries that it actually encounters and handles, and after that it checks to ensure that this
set is empty. If not there are subqueries left that were not joined back.public void internalUseQuery(QSubQuery<?,?> q)
q - Copyright © 2017 etc.to. All rights reserved.