Skip to content

Commit efd0de8

Browse files
committed
Add convenience method that is easire to grok
1 parent cfe58a3 commit efd0de8

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ public boolean skipRenderingWhenEmpty() {
4444
return skipRenderingWhenEmpty;
4545
}
4646

47+
/**
48+
* Use with caution - this could cause the library to render invalid SQL like "where column in ()".
49+
*/
50+
protected void forceRenderingWhenEmpty() {
51+
skipRenderingWhenEmpty = false;
52+
}
53+
4754
@Override
4855
public <R> R accept(ConditionVisitor<T, R> visitor) {
4956
return visitor.visit(this);

src/test/java/examples/animal/data/AnimalDataTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ void testInConditionWithEmptyList() {
589589
public static class IsInRequired<T> extends IsIn<T> {
590590
protected IsInRequired(Collection<T> values) {
591591
super(values);
592-
skipRenderingWhenEmpty = false;
592+
forceRenderingWhenEmpty();
593593
}
594594

595595
public static <T> IsInRequired<T> isIn(Collection<T> values) {

0 commit comments

Comments
 (0)