Interface RenderableCondition<T>
- All Known Subinterfaces:
CaseInsensitiveRenderableCondition<T>, VisitableCondition<T>
- All Known Implementing Classes:
AbstractColumnComparisonCondition, AbstractListValueCondition, AbstractNoValueCondition, AbstractSingleValueCondition, AbstractSubselectCondition, AbstractTwoValueCondition, IsBetween, IsBetweenWhenPresent, IsEqualTo, IsEqualToColumn, IsEqualToWhenPresent, IsEqualToWithSubselect, IsGreaterThan, IsGreaterThanColumn, IsGreaterThanOrEqualTo, IsGreaterThanOrEqualToColumn, IsGreaterThanOrEqualToWhenPresent, IsGreaterThanOrEqualToWithSubselect, IsGreaterThanWhenPresent, IsGreaterThanWithSubselect, IsIn, IsInCaseInsensitive, IsInCaseInsensitiveWhenPresent, IsInWhenPresent, IsInWithSubselect, IsLessThan, IsLessThanColumn, IsLessThanOrEqualTo, IsLessThanOrEqualToColumn, IsLessThanOrEqualToWhenPresent, IsLessThanOrEqualToWithSubselect, IsLessThanWhenPresent, IsLessThanWithSubselect, IsLike, IsLikeCaseInsensitive, IsLikeCaseInsensitiveWhenPresent, IsLikeWhenPresent, IsNotBetween, IsNotBetweenWhenPresent, IsNotEqualTo, IsNotEqualToColumn, IsNotEqualToWhenPresent, IsNotEqualToWithSubselect, IsNotIn, IsNotInCaseInsensitive, IsNotInCaseInsensitiveWhenPresent, IsNotInWhenPresent, IsNotInWithSubselect, IsNotLike, IsNotLikeCaseInsensitive, IsNotLikeCaseInsensitiveWhenPresent, IsNotLikeWhenPresent, IsNotNull, IsNull
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanisEmpty()Subclasses can override this to indicate whether the condition is considered empty.renderCondition(RenderingContext renderingContext, BindableColumn<T> leftColumn) Render a condition - typically a condition in a WHERE clause.default voidThis method will be called during rendering whenshouldRender(RenderingContext)returns false.default FragmentAndParametersrenderLeftColumn(RenderingContext renderingContext, BindableColumn<T> leftColumn) Render the column in a column and condition phrase - typically in a WHERE clause.default booleanshouldRender(RenderingContext renderingContext) Subclasses can override this to inform the renderer if the condition should not be included in the rendered SQL.
-
Method Details
-
renderCondition
FragmentAndParameters renderCondition(RenderingContext renderingContext, BindableColumn<T> leftColumn) Render a condition - typically a condition in a WHERE clause.A rendered condition includes an SQL fragment, and any associated parameters. For example, the
isEqualcondition should be rendered as "= ?" where "?" is a properly formatted parameter marker (the parameter marker can be computed from theRenderingContext). Note that a rendered condition should NOT include the left side of the phrase - that is rendered by therenderLeftColumn(RenderingContext, BindableColumn)method.- Parameters:
renderingContext- the current rendering contextleftColumn- the column related to this condition in a where clause- Returns:
- the rendered condition. Should NOT include the column.
-
renderLeftColumn
default FragmentAndParameters renderLeftColumn(RenderingContext renderingContext, BindableColumn<T> leftColumn) Render the column in a column and condition phrase - typically in a WHERE clause.By default, the column will be rendered as the column alias if it exists, or the column name. This can be complicated if the column has a table qualifier, or if the "column" is a function or part of a CASE expression. Columns know how to render themselves, so we just call their "render" methods.
- Parameters:
renderingContext- the current rendering contextleftColumn- the column related to this condition in a where clause- Returns:
- the rendered column
-
shouldRender
Subclasses can override this to inform the renderer if the condition should not be included in the rendered SQL. Typically, conditions will not render if they are empty.- Returns:
- true if the condition should render.
-
isEmpty
default boolean isEmpty()Subclasses can override this to indicate whether the condition is considered empty. This is primarily used in map and filter operations - the map and filter functions will not be applied if the condition is empty.- Returns:
- true if the condition is empty.
-
renderingSkipped
default void renderingSkipped()This method will be called during rendering whenshouldRender(RenderingContext)returns false.
-