Skip to content

Commit e262018

Browse files
committed
Improve Javadocs
1 parent e41a112 commit e262018

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/main/java/org/mybatis/dynamic/sql/render/RenderingStrategy.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,38 @@
3636
public abstract class RenderingStrategy {
3737
public static final String DEFAULT_PARAMETER_PREFIX = "parameters"; //$NON-NLS-1$
3838

39+
/**
40+
* Return a unique key that can be used to place a parameter value in the parameter map
41+
*
42+
* @param sequence a sequence for calculating a unique value
43+
* @return a key used to place the parameter value in the parameter map
44+
*/
3945
public String formatParameterMapKey(AtomicInteger sequence) {
4046
return "p" + sequence.getAndIncrement(); //$NON-NLS-1$
4147
}
4248

49+
/**
50+
* Return a parameter map key intended as a parameter for a limit or fetch first query.
51+
*
52+
* <p>By default, this parameter is treated the same as any other. This method is a hook to support
53+
* MyBatis Spring Batch.
54+
*
55+
* @param sequence a sequence for calculating a unique value
56+
* @return a key used to place the parameter value in the parameter map
57+
*/
4358
public String formatParameterMapKeyForLimit(AtomicInteger sequence) {
4459
return formatParameterMapKey(sequence);
4560
}
4661

62+
/**
63+
* Return a parameter map key intended as a parameter for a query offset.
64+
*
65+
* <p>By default, this parameter is treated the same as any other. This method is a hook to support
66+
* MyBatis Spring Batch.
67+
*
68+
* @param sequence a sequence for calculating a unique value
69+
* @return a key used to place the parameter value in the parameter map
70+
*/
4771
public String formatParameterMapKeyForOffset(AtomicInteger sequence) {
4872
return formatParameterMapKey(sequence);
4973
}
@@ -86,6 +110,19 @@ public String formatParameterMapKeyForOffset(AtomicInteger sequence) {
86110
*/
87111
public abstract String getFormattedJdbcPlaceholder(String prefix, String parameterName);
88112

113+
/**
114+
* This method generates a binding for a parameter to a placeholder in a generated SQL statement.
115+
*
116+
* <p>This method is used to generate bindings for limit, offset, and fetch first parameters. By default, these
117+
* parameters are treated the same as any other. This method supports MyBatis Spring Batch integration where the
118+
* parameter keys have predefined values and need special handling.
119+
*
120+
* @param prefix parameter prefix used for locating the parameters in a SQL provider object. Typically, will be
121+
* {@link RenderingStrategy#DEFAULT_PARAMETER_PREFIX}. This is ignored for Spring.
122+
* @param parameterName name of the parameter. Typically generated by calling
123+
* {@link RenderingStrategy#formatParameterMapKey(AtomicInteger)}
124+
* @return the generated binding
125+
*/
89126
public String getFormattedJdbcPlaceholderForLimitOrOffset(String prefix, String parameterName) {
90127
return getFormattedJdbcPlaceholder(prefix, parameterName);
91128
}

0 commit comments

Comments
 (0)