Skip to content

Commit 6e043d9

Browse files
committed
Checkstyle
1 parent ffd7cf2 commit 6e043d9

File tree

6 files changed

+19
-10
lines changed

6 files changed

+19
-10
lines changed

CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ However, there are some changes in behavior and one breaking change.
2626
methods that accept Suppliers will call the `Supplier.get()` method when the condition is constructed. This should
2727
have no impact unless you were somehow relying on the delay in obtaining a value until the condition was rendered.
2828
1. The existing "then" and "when" methods have been deprecated and replaced with "map" and "filter" respectively.
29-
The new method names are more familiar and more representative of what these methods actually do. In effect,
29+
The new method names are more familiar and more representative of what these methods actually do. In effect
3030
these methods mimic the function of the "map" and "filter" methods on "java.util.Optional" and they are used
3131
for a similar purpose.
32-
1. The new "filter" method works a bit differently than the "when" method it replaces. The "when" method could not
32+
1. The new "filter" method works a bit differently than the "when" method it replaces. The old "when" method could not
3333
be chained - if it was called multiple times, only the last call would take effect. The new "filter" methods works
3434
as it should and every call will take effect.
35+
1. The new "map" method will allow you to change the datatype of a condition as is normal for a "map" method. You
36+
can use this method to apply a type conversion directly within condition.
3537
1. All the "WhenPresent" conditions have been removed as separate classes. The methods that produced these conditions
36-
in the SqlBuilder remain, and they will now produce a condition with a "NotNull" filter applied. So at the API level,
38+
in the SqlBuilder remain, and they will now produce a condition with a "NotNull" filter applied. So at the API level
3739
things will function exactly as before, but the intermediate classes will be different.
3840
1. One breaking change is that the builder for List value conditions has been removed without replacement. If you
3941
were using this builder to supply a "value stream transformer", then the replacement is to build a new List value

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717

1818
import java.util.Collection;
1919
import java.util.Objects;
20-
import java.util.function.*;
20+
import java.util.function.BiFunction;
21+
import java.util.function.Function;
22+
import java.util.function.Predicate;
23+
import java.util.function.Supplier;
2124
import java.util.stream.Collectors;
2225
import java.util.stream.Stream;
2326

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
*/
1616
package org.mybatis.dynamic.sql;
1717

18-
import java.util.function.*;
18+
import java.util.function.BiFunction;
19+
import java.util.function.BiPredicate;
20+
import java.util.function.Function;
21+
import java.util.function.Supplier;
1922

2023
public abstract class AbstractTwoValueCondition<T>
2124
implements VisitableCondition<T> {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ public IsIn<T> filter(Predicate<? super T> predicate) {
9292
* that will not render.
9393
*/
9494
public <R> IsIn<R> map(Function<? super T, ? extends R> mapper) {
95-
// the cast is a work around for a parse error in IntelliJ
96-
return mapSupport(mapper, (BiFunction<Collection<R>, Callback, IsIn<R>>) IsIn::new, IsIn::empty);
95+
BiFunction<Collection<R>, Callback, IsIn<R>> constructor = IsIn::new;
96+
return mapSupport(mapper, constructor, IsIn::empty);
9797
}
9898

9999
@SafeVarargs

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ public IsNotIn<T> filter(Predicate<? super T> predicate) {
9494
* that will not render.
9595
*/
9696
public <R> IsNotIn<R> map(Function<? super T, ? extends R> mapper) {
97-
// the cast is a work around for a parse error in IntelliJ
98-
return mapSupport(mapper, (BiFunction<Collection<R>, Callback, IsNotIn<R>>) IsNotIn::new, IsNotIn::empty);
97+
BiFunction<Collection<R>, Callback, IsNotIn<R>> constructor = IsNotIn::new;
98+
return mapSupport(mapper, constructor, IsNotIn::empty);
9999
}
100100

101101
@SafeVarargs

src/test/java/org/mybatis/dynamic/sql/where/condition/FilterAndMapTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ void testTypeConversion() {
3636

3737
@Test
3838
void testTypeConversionWithNullThrowsException() {
39+
IsEqualTo<String> cond = SqlBuilder.isEqualTo((String) null);
3940
assertThatExceptionOfType(NumberFormatException.class).isThrownBy(() ->
40-
SqlBuilder.isEqualTo((String) null).map(Integer::parseInt)
41+
cond.map(Integer::parseInt)
4142
);
4243
}
4344

0 commit comments

Comments
 (0)