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) {
6565 }
6666
6767 public Builder withParameter (String key , @ Nullable Object value ) {
68+ // the value can be null because a parameter type converter may return null
69+
6870 //noinspection DataFlowIssue
6971 parameters .put (key , value );
7072 return this ;
Original file line number Diff line number Diff line change @@ -72,6 +72,8 @@ public Builder withFragment(String fragment) {
7272 }
7373
7474 public Builder withParameter (String key , @ Nullable Object value ) {
75+ // the value can be null because a parameter type converter may return null
76+
7577 //noinspection DataFlowIssue
7678 parameters .put (key , value );
7779 return this ;
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public class ValueOrNullMapping<T> extends AbstractColumnMapping {
2828 // keep a reference to the column so we don't lose the type
2929 private final SqlColumn <T > localColumn ;
3030
31- private ValueOrNullMapping (SqlColumn <T > column , Supplier <T > valueSupplier ) {
31+ private ValueOrNullMapping (SqlColumn <T > column , Supplier <@ Nullable T > valueSupplier ) {
3232 super (column );
3333 this .valueSupplier = Objects .requireNonNull (valueSupplier );
3434 localColumn = Objects .requireNonNull (column );
@@ -43,7 +43,7 @@ public <R> R accept(ColumnMappingVisitor<R> visitor) {
4343 return visitor .visit (this );
4444 }
4545
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 ) {
4747 return new ValueOrNullMapping <>(column , valueSupplier );
4848 }
4949}
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public class ValueWhenPresentMapping<T> extends AbstractColumnMapping {
2828 // keep a reference to the column so we don't lose the type
2929 private final SqlColumn <T > localColumn ;
3030
31- private ValueWhenPresentMapping (SqlColumn <T > column , Supplier <T > valueSupplier ) {
31+ private ValueWhenPresentMapping (SqlColumn <T > column , Supplier <@ Nullable T > valueSupplier ) {
3232 super (column );
3333 this .valueSupplier = Objects .requireNonNull (valueSupplier );
3434 localColumn = Objects .requireNonNull (column );
@@ -47,7 +47,7 @@ public <R> R accept(ColumnMappingVisitor<R> visitor) {
4747 return visitor .visit (this );
4848 }
4949
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 ) {
5151 return new ValueWhenPresentMapping <>(column , valueSupplier );
5252 }
5353}
Original file line number Diff line number Diff line change 2323
2424import org .mybatis .dynamic .sql .AbstractListValueCondition ;
2525import org .mybatis .dynamic .sql .render .RenderingContext ;
26+ import org .mybatis .dynamic .sql .util .StringUtilities ;
2627import org .mybatis .dynamic .sql .util .Validator ;
2728
2829public class IsInCaseInsensitive extends AbstractListValueCondition <String >
@@ -69,6 +70,8 @@ public static IsInCaseInsensitive of(String... values) {
6970 }
7071
7172 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 );
7376 }
7477}
Original file line number Diff line number Diff line change 2323
2424import org .jspecify .annotations .Nullable ;
2525import org .mybatis .dynamic .sql .AbstractListValueCondition ;
26+ import org .mybatis .dynamic .sql .util .StringUtilities ;
2627import org .mybatis .dynamic .sql .util .Utilities ;
2728
2829public class IsInCaseInsensitiveWhenPresent extends AbstractListValueCondition <String >
@@ -65,6 +66,8 @@ public static IsInCaseInsensitiveWhenPresent of(@Nullable String... values) {
6566 }
6667
6768 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 );
6972 }
7073}
Original file line number Diff line number Diff line change 2020import java .util .function .UnaryOperator ;
2121
2222import org .mybatis .dynamic .sql .AbstractSingleValueCondition ;
23+ import org .mybatis .dynamic .sql .util .StringUtilities ;
2324
2425public class IsLikeCaseInsensitive extends AbstractSingleValueCondition <String >
2526 implements CaseInsensitiveVisitableCondition {
@@ -66,6 +67,8 @@ public IsLikeCaseInsensitive map(UnaryOperator<String> mapper) {
6667 }
6768
6869 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 );
7073 }
7174}
Original file line number Diff line number Diff line change 2323
2424import org .mybatis .dynamic .sql .AbstractListValueCondition ;
2525import org .mybatis .dynamic .sql .render .RenderingContext ;
26+ import org .mybatis .dynamic .sql .util .StringUtilities ;
2627import org .mybatis .dynamic .sql .util .Validator ;
2728
2829public class IsNotInCaseInsensitive extends AbstractListValueCondition <String >
@@ -69,6 +70,8 @@ public static IsNotInCaseInsensitive of(String... values) {
6970 }
7071
7172 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 );
7376 }
7477}
Original file line number Diff line number Diff line change 2323
2424import org .jspecify .annotations .Nullable ;
2525import org .mybatis .dynamic .sql .AbstractListValueCondition ;
26+ import org .mybatis .dynamic .sql .util .StringUtilities ;
2627import org .mybatis .dynamic .sql .util .Utilities ;
2728
2829public class IsNotInCaseInsensitiveWhenPresent extends AbstractListValueCondition <String >
@@ -65,6 +66,8 @@ public static IsNotInCaseInsensitiveWhenPresent of(@Nullable String... values) {
6566 }
6667
6768 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 );
6972 }
7073}
Original file line number Diff line number Diff line change 2020import java .util .function .UnaryOperator ;
2121
2222import org .mybatis .dynamic .sql .AbstractSingleValueCondition ;
23+ import org .mybatis .dynamic .sql .util .StringUtilities ;
2324
2425public class IsNotLikeCaseInsensitive extends AbstractSingleValueCondition <String >
2526 implements CaseInsensitiveVisitableCondition {
@@ -68,6 +69,8 @@ public IsNotLikeCaseInsensitive map(UnaryOperator<String> mapper) {
6869 }
6970
7071 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 );
7275 }
7376}
You can’t perform that action at this time.
0 commit comments