public class CriterionRenderer extends Object implements SqlCriterionVisitor<Optional<RenderedCriterion>>
SqlCriterion
to a RenderedCriterion
. 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.
Modifier and Type | Class and Description |
---|---|
static class |
CriterionRenderer.Builder |
Modifier and Type | Method and Description |
---|---|
<T> Optional<RenderedCriterion> |
visit(ColumnAndConditionCriterion<T> criterion) |
Optional<RenderedCriterion> |
visit(ExistsCriterion criterion) |
public <T> Optional<RenderedCriterion> visit(ColumnAndConditionCriterion<T> criterion)
visit
in interface SqlCriterionVisitor<Optional<RenderedCriterion>>
public Optional<RenderedCriterion> visit(ExistsCriterion criterion)
visit
in interface SqlCriterionVisitor<Optional<RenderedCriterion>>
Copyright © 2016–2021 MyBatis.org. All rights reserved.