18
18
import java .net .InetAddress ;
19
19
import java .net .URI ;
20
20
import java .net .URL ;
21
- import java .util .ArrayList ;
22
21
import java .util .Arrays ;
23
22
import java .util .Collection ;
24
23
import java .util .Collections ;
25
24
import java .util .HashSet ;
26
25
import java .util .List ;
27
26
import java .util .Set ;
28
27
import java .util .UUID ;
28
+
29
29
import org .springframework .core .convert .converter .Converter ;
30
30
31
31
/**
@@ -45,19 +45,11 @@ public class MySqlDialect extends org.springframework.data.relational.core.diale
45
45
public static final MySqlDialect INSTANCE = new MySqlDialect ();
46
46
47
47
private static final BindMarkersFactory ANONYMOUS = BindMarkersFactory .anonymous ("?" );
48
-
48
+
49
49
/**
50
- * MySql specific converters.
50
+ * MySQL specific converters.
51
51
*/
52
- public static final List <Object > CONVERTERS ;
53
-
54
- static {
55
- List <Object > converters = new ArrayList <>();
56
-
57
- converters .add (ByteToBooleanConverter .INSTANCE );
58
-
59
- CONVERTERS = Collections .unmodifiableList (converters );
60
- }
52
+ private static final List <Object > CONVERTERS = Collections .singletonList (ByteToBooleanConverter .INSTANCE );
61
53
62
54
/*
63
55
* (non-Javadoc)
@@ -76,7 +68,7 @@ public BindMarkersFactory getBindMarkersFactory() {
76
68
public Collection <? extends Class <?>> getSimpleTypes () {
77
69
return SIMPLE_TYPES ;
78
70
}
79
-
71
+
80
72
/*
81
73
* (non-Javadoc)
82
74
* @see org.springframework.data.r2dbc.dialect.R2dbcDialect#getConverters()
@@ -85,11 +77,10 @@ public Collection<? extends Class<?>> getSimpleTypes() {
85
77
public Collection <Object > getConverters () {
86
78
return CONVERTERS ;
87
79
}
88
-
80
+
89
81
/**
90
- * Simple singleton to convert {@link Byte}s to their {@link Boolean}
91
- * representation. MySQL does not have a built in boolean type by default,
92
- * so relies on using a byte instead. Non-zero values represent true.
82
+ * Simple singleton to convert {@link Byte}s to their {@link Boolean} representation. MySQL does not have a built-in
83
+ * boolean type by default, so relies on using a byte instead. Non-zero values represent {@literal true}.
93
84
*
94
85
* @author Michael Berry
95
86
*/
@@ -99,9 +90,11 @@ public enum ByteToBooleanConverter implements Converter<Byte, Boolean> {
99
90
100
91
@ Override
101
92
public Boolean convert (Byte s ) {
93
+
102
94
if (s == null ) {
103
95
return null ;
104
96
}
97
+
105
98
return s != 0 ;
106
99
}
107
100
}
0 commit comments