File tree Expand file tree Collapse file tree 10 files changed +32
-10
lines changed
src/main/java/org/mybatis/dynamic/sql Expand file tree Collapse file tree 10 files changed +32
-10
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,8 @@ public Builder withValuePhrase(String valuePhrase) {
65
65
}
66
66
67
67
public Builder withParameter (String key , @ Nullable Object value ) {
68
+ // the value can be null because a parameter type converter may return null
69
+
68
70
//noinspection DataFlowIssue
69
71
parameters .put (key , value );
70
72
return this ;
Original file line number Diff line number Diff line change @@ -72,6 +72,8 @@ public Builder withFragment(String fragment) {
72
72
}
73
73
74
74
public Builder withParameter (String key , @ Nullable Object value ) {
75
+ // the value can be null because a parameter type converter may return null
76
+
75
77
//noinspection DataFlowIssue
76
78
parameters .put (key , value );
77
79
return this ;
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public class ValueOrNullMapping<T> extends AbstractColumnMapping {
28
28
// keep a reference to the column so we don't lose the type
29
29
private final SqlColumn <T > localColumn ;
30
30
31
- private ValueOrNullMapping (SqlColumn <T > column , Supplier <T > valueSupplier ) {
31
+ private ValueOrNullMapping (SqlColumn <T > column , Supplier <@ Nullable T > valueSupplier ) {
32
32
super (column );
33
33
this .valueSupplier = Objects .requireNonNull (valueSupplier );
34
34
localColumn = Objects .requireNonNull (column );
@@ -43,7 +43,7 @@ public <R> R accept(ColumnMappingVisitor<R> visitor) {
43
43
return visitor .visit (this );
44
44
}
45
45
46
- public static <T > ValueOrNullMapping <T > of (SqlColumn <T > column , Supplier <T > valueSupplier ) {
46
+ public static <T > ValueOrNullMapping <T > of (SqlColumn <T > column , Supplier <@ Nullable T > valueSupplier ) {
47
47
return new ValueOrNullMapping <>(column , valueSupplier );
48
48
}
49
49
}
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public class ValueWhenPresentMapping<T> extends AbstractColumnMapping {
28
28
// keep a reference to the column so we don't lose the type
29
29
private final SqlColumn <T > localColumn ;
30
30
31
- private ValueWhenPresentMapping (SqlColumn <T > column , Supplier <T > valueSupplier ) {
31
+ private ValueWhenPresentMapping (SqlColumn <T > column , Supplier <@ Nullable T > valueSupplier ) {
32
32
super (column );
33
33
this .valueSupplier = Objects .requireNonNull (valueSupplier );
34
34
localColumn = Objects .requireNonNull (column );
@@ -47,7 +47,7 @@ public <R> R accept(ColumnMappingVisitor<R> visitor) {
47
47
return visitor .visit (this );
48
48
}
49
49
50
- public static <T > ValueWhenPresentMapping <T > of (SqlColumn <T > column , Supplier <T > valueSupplier ) {
50
+ public static <T > ValueWhenPresentMapping <T > of (SqlColumn <T > column , Supplier <@ Nullable T > valueSupplier ) {
51
51
return new ValueWhenPresentMapping <>(column , valueSupplier );
52
52
}
53
53
}
Original file line number Diff line number Diff line change 23
23
24
24
import org .mybatis .dynamic .sql .AbstractListValueCondition ;
25
25
import org .mybatis .dynamic .sql .render .RenderingContext ;
26
+ import org .mybatis .dynamic .sql .util .StringUtilities ;
26
27
import org .mybatis .dynamic .sql .util .Validator ;
27
28
28
29
public class IsInCaseInsensitive extends AbstractListValueCondition <String >
@@ -69,6 +70,8 @@ public static IsInCaseInsensitive of(String... values) {
69
70
}
70
71
71
72
public static IsInCaseInsensitive of (Collection <String > values ) {
72
- return new IsInCaseInsensitive (values ).map (String ::toUpperCase );
73
+ // Keep the null safe upper case utility for backwards compatibility
74
+ //noinspection DataFlowIssue
75
+ return new IsInCaseInsensitive (values ).map (StringUtilities ::safelyUpperCase );
73
76
}
74
77
}
Original file line number Diff line number Diff line change 23
23
24
24
import org .jspecify .annotations .Nullable ;
25
25
import org .mybatis .dynamic .sql .AbstractListValueCondition ;
26
+ import org .mybatis .dynamic .sql .util .StringUtilities ;
26
27
import org .mybatis .dynamic .sql .util .Utilities ;
27
28
28
29
public class IsInCaseInsensitiveWhenPresent extends AbstractListValueCondition <String >
@@ -65,6 +66,8 @@ public static IsInCaseInsensitiveWhenPresent of(@Nullable String... values) {
65
66
}
66
67
67
68
public static IsInCaseInsensitiveWhenPresent of (Collection <@ Nullable String > values ) {
68
- return new IsInCaseInsensitiveWhenPresent (values ).map (String ::toUpperCase );
69
+ // Keep the null safe upper case utility for backwards compatibility
70
+ //noinspection DataFlowIssue
71
+ return new IsInCaseInsensitiveWhenPresent (values ).map (StringUtilities ::safelyUpperCase );
69
72
}
70
73
}
Original file line number Diff line number Diff line change 20
20
import java .util .function .UnaryOperator ;
21
21
22
22
import org .mybatis .dynamic .sql .AbstractSingleValueCondition ;
23
+ import org .mybatis .dynamic .sql .util .StringUtilities ;
23
24
24
25
public class IsLikeCaseInsensitive extends AbstractSingleValueCondition <String >
25
26
implements CaseInsensitiveVisitableCondition {
@@ -66,6 +67,8 @@ public IsLikeCaseInsensitive map(UnaryOperator<String> mapper) {
66
67
}
67
68
68
69
public static IsLikeCaseInsensitive of (String value ) {
69
- return new IsLikeCaseInsensitive (value ).map (String ::toUpperCase );
70
+ // Keep the null safe upper case utility for backwards compatibility
71
+ //noinspection DataFlowIssue
72
+ return new IsLikeCaseInsensitive (value ).map (StringUtilities ::safelyUpperCase );
70
73
}
71
74
}
Original file line number Diff line number Diff line change 23
23
24
24
import org .mybatis .dynamic .sql .AbstractListValueCondition ;
25
25
import org .mybatis .dynamic .sql .render .RenderingContext ;
26
+ import org .mybatis .dynamic .sql .util .StringUtilities ;
26
27
import org .mybatis .dynamic .sql .util .Validator ;
27
28
28
29
public class IsNotInCaseInsensitive extends AbstractListValueCondition <String >
@@ -69,6 +70,8 @@ public static IsNotInCaseInsensitive of(String... values) {
69
70
}
70
71
71
72
public static IsNotInCaseInsensitive of (Collection <String > values ) {
72
- return new IsNotInCaseInsensitive (values ).map (String ::toUpperCase );
73
+ // Keep the null safe upper case utility for backwards compatibility
74
+ //noinspection DataFlowIssue
75
+ return new IsNotInCaseInsensitive (values ).map (StringUtilities ::safelyUpperCase );
73
76
}
74
77
}
Original file line number Diff line number Diff line change 23
23
24
24
import org .jspecify .annotations .Nullable ;
25
25
import org .mybatis .dynamic .sql .AbstractListValueCondition ;
26
+ import org .mybatis .dynamic .sql .util .StringUtilities ;
26
27
import org .mybatis .dynamic .sql .util .Utilities ;
27
28
28
29
public class IsNotInCaseInsensitiveWhenPresent extends AbstractListValueCondition <String >
@@ -65,6 +66,8 @@ public static IsNotInCaseInsensitiveWhenPresent of(@Nullable String... values) {
65
66
}
66
67
67
68
public static IsNotInCaseInsensitiveWhenPresent of (Collection <@ Nullable String > values ) {
68
- return new IsNotInCaseInsensitiveWhenPresent (values ).map (String ::toUpperCase );
69
+ // Keep the null safe upper case utility for backwards compatibility
70
+ //noinspection DataFlowIssue
71
+ return new IsNotInCaseInsensitiveWhenPresent (values ).map (StringUtilities ::safelyUpperCase );
69
72
}
70
73
}
Original file line number Diff line number Diff line change 20
20
import java .util .function .UnaryOperator ;
21
21
22
22
import org .mybatis .dynamic .sql .AbstractSingleValueCondition ;
23
+ import org .mybatis .dynamic .sql .util .StringUtilities ;
23
24
24
25
public class IsNotLikeCaseInsensitive extends AbstractSingleValueCondition <String >
25
26
implements CaseInsensitiveVisitableCondition {
@@ -68,6 +69,8 @@ public IsNotLikeCaseInsensitive map(UnaryOperator<String> mapper) {
68
69
}
69
70
70
71
public static IsNotLikeCaseInsensitive of (String value ) {
71
- return new IsNotLikeCaseInsensitive (value ).map (String ::toUpperCase );
72
+ // Keep the null safe upper case utility for backwards compatibility
73
+ //noinspection DataFlowIssue
74
+ return new IsNotLikeCaseInsensitive (value ).map (StringUtilities ::safelyUpperCase );
72
75
}
73
76
}
You can’t perform that action at this time.
0 commit comments