Class CriterionRenderer<T>
- java.lang.Object
-
- org.mybatis.dynamic.sql.where.render.CriterionRenderer<T>
-
- Type Parameters:
T
- the type of column to render. Not used during rendering.
public class CriterionRenderer<T> extends java.lang.Object
Renders aSqlCriterion
to aRenderedCriterion
. The process is complex because all conditions may or may not be a candidate for rendering. For example, "isEqualWhenPresent" will not render when the value is null. It is also complex because SqlCriterion may or may not include sub-criteria.Rendering is a recursive process. The renderer will recurse into each sub-criteria - which may also contain further sub-criteria - until all possible sub-criteria are rendered into a single fragment. So, for example, the fragment may end up looking like:
col1 = ? and (col2 = ? or (col3 = ? and col4 = ?))
It is also possible that the end result will be empty if all criteria and sub-criteria are not valid for rendering.
- Author:
- Jeff Butler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CriterionRenderer.Builder<T>
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<RenderedCriterion>
render()
static <T> CriterionRenderer.Builder<T>
withCriterion(SqlCriterion<T> sqlCriterion)
-
-
-
Method Detail
-
render
public java.util.Optional<RenderedCriterion> render()
-
withCriterion
public static <T> CriterionRenderer.Builder<T> withCriterion(SqlCriterion<T> sqlCriterion)
-
-