Skip to content

Commit 58c8521

Browse files
committed
Doc updates
1 parent dda1245 commit 58c8521

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,18 @@
2020
* during statement rendering before the parameter is placed into the parameter map. This can be used
2121
* to somewhat mimic the function of a MyBatis type handler for runtimes such as Spring that don't have
2222
* a corresponding concept.
23+
*
24+
* <p>Since Spring does not have the concept of type handlers, it is a best practice to only use
25+
* Java data types that have a clear correlation to SQL data types (for example Java String correlates
26+
* automatically with VARCHAR). Using a parameter type converter will allow you to use data types in your
27+
* model classes that would otherwise be difficult to use with Spring.
2328
*
2429
* <p>A parameter type converter is associated with a SqlColumn.
2530
*
2631
* <p>A parameter type converter is compatible with Spring's general Converter interface so existing converters
27-
* can be reused here if they are marked with this additional interface.
32+
* can be reused here if they are marked with this additional interface. The return type is always Object as the
33+
* converter is called immediately before a value is placed into a parameter Map and there is no longer any need for
34+
* the actual target type. Having a fixed return type removes quite a few generic hurdles.
2835
*
2936
* <p>The converter is only used for parameters - it is not used for result set processing. The converter will be
3037
* called in the following circumstances:
@@ -39,6 +46,7 @@
3946
*
4047
* @see SqlColumn
4148
* @author Jeff Butler
49+
* @since 1.1.5
4250
*/
4351
@FunctionalInterface
4452
public interface ParameterTypeConverter<S> {

0 commit comments

Comments
 (0)