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, ....)- Since:
- 3.16
- Author:
- nicklas
-
-
Field Summary
Fields Modifier and Type Field Description private Expression
idExpression
private Set<Integer>
idList
-
Constructor Summary
Constructors Constructor Description IdListRestriction()
IdListRestriction(Set<Integer> idList)
-
Method Summary
All Methods Instance Methods Concrete Methods 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.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 Detail
-
idExpression
private final Expression idExpression
-
-
Method Detail
-
toQl
public String toQl(Query query, DbControl dc)
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
public Collection<? extends QueryElement> 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
-
union
public void union(IdListRestriction other)
Merge this id list with another list. This list will now contain the combined set of ids from both lists.
-
intersect
public void intersect(IdListRestriction other)
Merge this id list with another list. This list will now contain only the ids that are found in both lists.
-
-