Skip to content

Commit 6f3241d

Browse files
committed
Carry the renderWhenEmpty flag throughout
This is getting ugly. Mutable classes are a nightmare. We'll fix this in another issue.
1 parent e6f289a commit 6f3241d

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

src/main/java/org/mybatis/dynamic/sql/where/condition/IsIn.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2016-2019 the original author or authors.
2+
* Copyright 2016-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -51,7 +51,9 @@ public String renderCondition(String columnName, Stream<String> placeholders) {
5151
* @return new condition with the specified transformer
5252
*/
5353
public IsIn<T> then(UnaryOperator<Stream<T>> valueStreamTransformer) {
54-
return new IsIn<>(values, valueStreamTransformer);
54+
IsIn<T> answer = new IsIn<>(values, valueStreamTransformer);
55+
answer.renderWhenEmpty = renderWhenEmpty;
56+
return answer;
5557
}
5658

5759
public static <T> IsIn<T> of(Collection<T> values) {

src/main/java/org/mybatis/dynamic/sql/where/condition/IsInCaseInsensitive.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2016-2019 the original author or authors.
2+
* Copyright 2016-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -50,7 +50,9 @@ public String renderCondition(String columnName, Stream<String> placeholders) {
5050
* @return new condition with the specified transformer
5151
*/
5252
public IsInCaseInsensitive then(UnaryOperator<Stream<String>> valueStreamTransformer) {
53-
return new IsInCaseInsensitive(values, valueStreamTransformer);
53+
IsInCaseInsensitive answer = new IsInCaseInsensitive(values, valueStreamTransformer);
54+
answer.renderWhenEmpty = renderWhenEmpty;
55+
return answer;
5456
}
5557

5658
public static IsInCaseInsensitive of(Collection<String> values) {

src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotIn.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2016-2019 the original author or authors.
2+
* Copyright 2016-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -52,7 +52,9 @@ public String renderCondition(String columnName, Stream<String> placeholders) {
5252
* @return new condition with the specified transformer
5353
*/
5454
public IsNotIn<T> then(UnaryOperator<Stream<T>> valueStreamTransformer) {
55-
return new IsNotIn<>(values, valueStreamTransformer);
55+
IsNotIn<T> answer = new IsNotIn<>(values, valueStreamTransformer);
56+
answer.renderWhenEmpty = renderWhenEmpty;
57+
return answer;
5658
}
5759

5860
public static <T> IsNotIn<T> of(Collection<T> values) {

src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotInCaseInsensitive.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2016-2019 the original author or authors.
2+
* Copyright 2016-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -51,7 +51,9 @@ public String renderCondition(String columnName, Stream<String> placeholders) {
5151
* @return new condition with the specified transformer
5252
*/
5353
public IsNotInCaseInsensitive then(UnaryOperator<Stream<String>> valueStreamTransformer) {
54-
return new IsNotInCaseInsensitive(values, valueStreamTransformer);
54+
IsNotInCaseInsensitive answer = new IsNotInCaseInsensitive(values, valueStreamTransformer);
55+
answer.renderWhenEmpty = renderWhenEmpty;
56+
return answer;
5557
}
5658

5759
public static IsNotInCaseInsensitive of(Collection<String> values) {

0 commit comments

Comments
 (0)