- java.lang.Object
-
- org.mybatis.dynamic.sql.where.render.CriterionRenderer
-
- All Implemented Interfaces:
SqlCriterionVisitor<Optional<RenderedCriterion>>
public class CriterionRenderer extends Object implements SqlCriterionVisitor<Optional<RenderedCriterion>>
Renders aSqlCriterionto 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 classCriterionRenderer.Builder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Optional<RenderedCriterion>visit(ColumnAndConditionCriterion<T> criterion)Optional<RenderedCriterion>visit(ExistsCriterion criterion)
-
-
-
Method Detail
-
visit
public <T> Optional<RenderedCriterion> visit(ColumnAndConditionCriterion<T> criterion)
- Specified by:
visitin interfaceSqlCriterionVisitor<Optional<RenderedCriterion>>
-
visit
public Optional<RenderedCriterion> visit(ExistsCriterion criterion)
- Specified by:
visitin interfaceSqlCriterionVisitor<Optional<RenderedCriterion>>
-
-