Class InCondition
java.lang.Object
org.tentackle.dbms.dsl.InCondition
- All Implemented Interfaces:
Condition, SqlElement
An expression tested to be one of a set of values or sub-select rows.
An empty set of values is rendered as a condition that is never true (always true if negated), which is what applications expect when they build the value set dynamically.
- Author:
- harald
-
Constructor Summary
ConstructorsConstructorDescriptionInCondition(Expression<?> expression, Collection<? extends Expression<?>> values, boolean negated) Creates a condition testing an expression against a set of values.InCondition(Expression<?> expression, Select select, boolean negated) Creates a condition testing an expression against the rows of a sub-select. -
Method Summary
Modifier and TypeMethodDescriptionExpression<?> Gets the tested expression.Gets the sub-select.List<Expression<?>> Gets the values.booleanReturns whether the expression is tested not to be one of the values.voidrender(RenderContext context) Renders this element into the given context.
-
Constructor Details
-
InCondition
public InCondition(Expression<?> expression, Collection<? extends Expression<?>> values, boolean negated) Creates a condition testing an expression against a set of values.- Parameters:
expression- the tested expressionvalues- the values, may be emptynegated- true forNOT IN, false forIN
-
InCondition
Creates a condition testing an expression against the rows of a sub-select.- Parameters:
expression- the tested expressionselect- the sub-select returning a single columnnegated- true forNOT IN, false forIN
-
-
Method Details
-
getExpression
-
getValues
Gets the values.- Returns:
- the unmodifiable list of values, null if this condition refers to a sub-select
-
getSelect
Gets the sub-select.- Returns:
- the sub-select, null if this condition refers to a list of values
-
isNegated
public boolean isNegated()Returns whether the expression is tested not to be one of the values.- Returns:
- true for
NOT IN, false forIN
-
render
Description copied from interface:SqlElementRenders this element into the given context.- Specified by:
renderin interfaceSqlElement- Parameters:
context- the render context
-