Package net.sf.basedb.core.query
Class IdListRestriction
java.lang.Object
net.sf.basedb.core.query.IdListRestriction
- All Implemented Interfaces:
QueryElement
,Restriction
public class IdListRestriction extends Object implements Restriction
Restriction that filters on a list of ID values:
id IN (a, b, c, ....)
id NOT IN (a, b, c, ....)
- Since:
- 3.16
- Author:
- nicklas
-
Field Summary
Fields Modifier and Type Field Description private Expression
idExpression
private Set<Integer>
idList
private boolean
notIn
private String
tmpTable
-
Constructor Summary
Constructors Constructor Description IdListRestriction()
IdListRestriction(boolean notIn)
IdListRestriction(boolean notIn, Set<Integer> idList)
IdListRestriction(String idProperty, boolean notIn, Collection<Integer> idList)
IdListRestriction(String idProperty, Collection<Integer> idList)
IdListRestriction(Set<Integer> idList)
-
Method Summary
Modifier and Type Method Description Collection<? extends QueryElement>
getChildren()
Get the children of this query element or null if it has no children.void
intersect(IdListRestriction other)
Merge this id list with another list.void
mergeAnd(IdListRestriction other)
Merge this list with another list with AND logic respecting the notIn setting.void
remove(IdListRestriction other)
Merge this id list with another list by removing ids that are found in the other list.String
toQl(Query query, DbControl dc)
Create a query language string of the query element.String
toString()
void
union(IdListRestriction other)
Merge this id list with another list.
-
Field Details
-
notIn
private boolean notIn -
idList
-
idExpression
-
tmpTable
-
-
Constructor Details
-
IdListRestriction
public IdListRestriction() -
IdListRestriction
public IdListRestriction(boolean notIn)- Since:
- 3.18
-
IdListRestriction
-
IdListRestriction
- Since:
- 3.19.8
-
IdListRestriction
- Since:
- 3.18
-
IdListRestriction
- Since:
- 3.19.8
-
-
Method Details
-
toQl
Description copied from interface:QueryElement
Create a query language string of the query element. Use theQuery.getQueryType()
method to find out which query language is wanted in case the element requires different syntax for different languages.- Specified by:
toQl
in interfaceQueryElement
- Parameters:
query
- The query that is about to be executeddc
- TheDbControl
object used to execute the query
-
getChildren
Description copied from interface:QueryElement
Get the children of this query element or null if it has no children. For example theAddExpression
has two children, the expression beeing added.- Specified by:
getChildren
in interfaceQueryElement
- Returns:
- A collection or null
-
toString
-
union
Merge this id list with another list. This list will now contain the combined set of ids from both lists. NOTE! This method ignore the 'notIn' setting for both lists. -
intersect
Merge this id list with another list. This list will now contain only the ids that are found in both lists. NOTE! This method ignore the 'notIn' setting for both lists. -
remove
Merge this id list with another list by removing ids that are found in the other list. NOTE! This method ignore the 'notIn' setting for both lists. -
mergeAnd
Merge this list with another list with AND logic respecting the notIn setting. This may cause the list of ids and notIn setting of this list to change.- Since:
- 3.18
-