Skip to content

Commit 7dd08ab

Browse files
committed
Documentation
1 parent fd7d6e8 commit 7dd08ab

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/main/java/org/mybatis/dynamic/sql/RenderableCondition.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,33 @@
2020

2121
@FunctionalInterface
2222
public interface RenderableCondition<T> {
23+
/**
24+
* Render a condition - typically a condition in a WHERE clause.
25+
*
26+
* <p>A rendered condition includes an SQL fragment, and any associated parameters. For example,
27+
* the <code>isEqual</code> condition should be rendered as "= ?" where "?" is a properly formatted
28+
* parameter marker (the parameter marker can be computed from the <code>RenderingContext</code>).
29+
* Note that a rendered condition should NOT include the left side of the phrase - that is rendered
30+
* by the {@link RenderableCondition#renderLeftColumn(RenderingContext, BindableColumn)} method.
31+
*
32+
* @param renderingContext the current rendering context
33+
* @param leftColumn the column related to this condition in a where clause
34+
* @return the rendered condition. Should NOT include the column.
35+
*/
2336
FragmentAndParameters renderCondition(RenderingContext renderingContext, BindableColumn<T> leftColumn);
2437

38+
/**
39+
* Render the column in a column and condition phrase - typically in a WHERE clause.
40+
*
41+
* <p>By default, the column will be rendered as the column alias if it exists, or the column name.
42+
* This can be complicated if the column has a table qualifier, or if the "column" is a function or
43+
* part of a CASE expression. Columns know how to render themselves, so we just call their "render"
44+
* methods.
45+
*
46+
* @param renderingContext the current rendering context
47+
* @param leftColumn the column related to this condition in a where clause
48+
* @return the rendered column
49+
*/
2550
default FragmentAndParameters renderLeftColumn(RenderingContext renderingContext, BindableColumn<T> leftColumn) {
2651
return leftColumn.alias()
2752
.map(FragmentAndParameters::fromFragment)

0 commit comments

Comments
 (0)