Skip to content

Commit 04dcae8

Browse files
committed
[ci] Format javadocs
1 parent 18ea56c commit 04dcae8

File tree

6 files changed

+77
-71
lines changed

6 files changed

+77
-71
lines changed

src/main/java/org/mybatis/scripting/freemarker/FreeMarkerLanguageDriver.java

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2015-2017 the original author or authors.
2+
* Copyright 2015-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,9 +35,8 @@
3535
import org.apache.ibatis.session.Configuration;
3636

3737
/**
38-
* Adds FreeMarker templates support to scripting in MyBatis.
39-
* If you want to change or extend template loader configuration, use can
40-
* inherit from this class and override {@link #createFreeMarkerConfiguration()} method.
38+
* Adds FreeMarker templates support to scripting in MyBatis. If you want to change or extend template loader
39+
* configuration, use can inherit from this class and override {@link #createFreeMarkerConfiguration()} method.
4140
*
4241
* @author elwood
4342
*/
@@ -73,10 +72,8 @@ public FreeMarkerLanguageDriver() {
7372
}
7473

7574
/**
76-
* Creates the {@link freemarker.template.Configuration} instance
77-
* and sets it up. If you want to change it (set another props, for
78-
* example), you can override it in inherited class and use your own
79-
* class in @Lang directive.
75+
* Creates the {@link freemarker.template.Configuration} instance and sets it up. If you want to change it (set
76+
* another props, for example), you can override it in inherited class and use your own class in @Lang directive.
8077
*/
8178
protected freemarker.template.Configuration createFreeMarkerConfiguration() {
8279
freemarker.template.Configuration cfg = new freemarker.template.Configuration(
@@ -95,13 +92,15 @@ protected freemarker.template.Configuration createFreeMarkerConfiguration() {
9592
}
9693

9794
/**
98-
* Creates a {@link ParameterHandler} that passes the actual parameters
99-
* to the the JDBC statement.
95+
* Creates a {@link ParameterHandler} that passes the actual parameters to the the JDBC statement.
10096
*
10197
* @see DefaultParameterHandler
102-
* @param mappedStatement The mapped statement that is being executed
103-
* @param parameterObject The input parameter object (can be null)
104-
* @param boundSql The resulting SQL once the dynamic language has been executed.
98+
* @param mappedStatement
99+
* The mapped statement that is being executed
100+
* @param parameterObject
101+
* The input parameter object (can be null)
102+
* @param boundSql
103+
* The resulting SQL once the dynamic language has been executed.
105104
*/
106105
@Override
107106
public ParameterHandler createParameterHandler(MappedStatement mappedStatement, Object parameterObject,
@@ -111,29 +110,33 @@ public ParameterHandler createParameterHandler(MappedStatement mappedStatement,
111110
}
112111

113112
/**
114-
* Creates an {@link SqlSource} that will hold the statement read
115-
* from a mapper xml file. It is called during startup, when the
116-
* mapped statement is read from a class or an xml file.
113+
* Creates an {@link SqlSource} that will hold the statement read from a mapper xml file. It is called during startup,
114+
* when the mapped statement is read from a class or an xml file.
117115
*
118-
* @param configuration The MyBatis configuration
119-
* @param script XNode parsed from a XML file
120-
* @param parameterType input parameter type got from a mapper method
121-
* or specified in the parameterType xml attribute. Can be null.
116+
* @param configuration
117+
* The MyBatis configuration
118+
* @param script
119+
* XNode parsed from a XML file
120+
* @param parameterType
121+
* input parameter type got from a mapper method or specified in the parameterType xml attribute. Can be
122+
* null.
122123
*/
123124
@Override
124125
public SqlSource createSqlSource(Configuration configuration, XNode script, Class<?> parameterType) {
125126
return createSqlSource(configuration, script.getNode().getTextContent());
126127
}
127128

128129
/**
129-
* Creates an {@link SqlSource} that will hold the statement read
130-
* from an annotation. It is called during startup, when the mapped
131-
* statement is read from a class or an xml file.
130+
* Creates an {@link SqlSource} that will hold the statement read from an annotation. It is called during startup,
131+
* when the mapped statement is read from a class or an xml file.
132132
*
133-
* @param configuration The MyBatis configuration
134-
* @param script The content of the annotation
135-
* @param parameterType input parameter type got from a mapper method
136-
* or specified in the parameterType xml attribute. Can be null.
133+
* @param configuration
134+
* The MyBatis configuration
135+
* @param script
136+
* The content of the annotation
137+
* @param parameterType
138+
* input parameter type got from a mapper method or specified in the parameterType xml attribute. Can be
139+
* null.
137140
*/
138141
@Override
139142
public SqlSource createSqlSource(Configuration configuration, String script, Class<?> parameterType) {

src/main/java/org/mybatis/scripting/freemarker/FreeMarkerSqlSource.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2015-2017 the original author or authors.
2+
* Copyright 2015-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,10 +30,8 @@
3030
import org.apache.ibatis.session.Configuration;
3131

3232
/**
33-
* Applies provided parameter(s) to FreeMarker template.
34-
* Then passes the result into default MyBatis engine
35-
* (and it finally replaces #{}-params to '?'-params).
36-
* So, FreeMarker is used as preprocessor for MyBatis engine.
33+
* Applies provided parameter(s) to FreeMarker template. Then passes the result into default MyBatis engine (and it
34+
* finally replaces #{}-params to '?'-params). So, FreeMarker is used as preprocessor for MyBatis engine.
3735
*
3836
* @author elwood
3937
*/
@@ -49,10 +47,8 @@ public FreeMarkerSqlSource(Template template, Configuration configuration) {
4947
}
5048

5149
/**
52-
* Populates additional parameters to data context.
53-
* Data context can be {@link java.util.Map}
54-
* or {@link org.mybatis.scripting.freemarker.ParamObjectAdapter}
55-
* instance.
50+
* Populates additional parameters to data context. Data context can be {@link java.util.Map} or
51+
* {@link org.mybatis.scripting.freemarker.ParamObjectAdapter} instance.
5652
*/
5753
protected Object preProcessDataContext(Object dataContext, boolean isMap) {
5854
if (isMap) {

src/main/java/org/mybatis/scripting/freemarker/MyBatisParamDirective.java

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2015-2017 the original author or authors.
2+
* Copyright 2015-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,34 +33,45 @@
3333
import java.util.Map;
3434

3535
/**
36-
* Custom FreeMarker directive for generating "#{paramName}" declarations in convenient way.
37-
* Problem is FreeMarker supports this syntax natively and there are no chance to disable this
38-
* (although it is deprecated). And to get "#{paramName}" we should write ${r"#{paramName}"}.
39-
* With this directive you can write more simple:
36+
* Custom FreeMarker directive for generating "#{paramName}" declarations in convenient way. Problem is FreeMarker
37+
* supports this syntax natively and there are no chance to disable this (although it is deprecated). And to get
38+
* "#{paramName}" we should write ${r"#{paramName}"}. With this directive you can write more simple:
4039
*
41-
* <blockquote><pre>
40+
* <blockquote>
41+
*
42+
* <pre>
4243
* &lt;@p name="paramName"/&gt;
43-
* </pre></blockquote>
44+
* </pre>
45+
*
46+
* </blockquote>
4447
*
4548
* <p>
46-
* Also directive supports `value` attribute. If it is specified, param will take passed value
47-
* and create the corresponding #{}-parameter. This is useful in loops:
49+
* Also directive supports `value` attribute. If it is specified, param will take passed value and create the
50+
* corresponding #{}-parameter. This is useful in loops:
4851
* </p>
4952
*
50-
* <blockquote><pre>
53+
* <blockquote>
54+
*
55+
* <pre>
5156
* &lt;#list ids as id&gt;
5257
* &lt;@p value=id/&gt;
5358
* &lt;#if id_has_next&gt;,&lt;/#if&gt;
5459
* &lt;/#list&gt;
55-
* </pre></blockquote>
60+
* </pre>
61+
*
62+
* </blockquote>
5663
*
5764
* <p>
5865
* will be translated into
5966
* </p>
6067
*
61-
* <blockquote><pre>
68+
* <blockquote>
69+
*
70+
* <pre>
6271
* #{_p0},#{_p1},#{_p2}
63-
* </pre></blockquote>
72+
* </pre>
73+
*
74+
* </blockquote>
6475
*
6576
* <p>
6677
* And MyBatis engine will convert it to `?`-params finally.

src/main/java/org/mybatis/scripting/freemarker/ParamObjectAdapter.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2015-2017 the original author or authors.
2+
* Copyright 2015-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,8 +26,8 @@
2626
import java.util.HashMap;
2727

2828
/**
29-
* Important: if you are using some object that already has property "p", then
30-
* MyBatisParamDirective will be unavailable from script.
29+
* Important: if you are using some object that already has property "p", then MyBatisParamDirective will be unavailable
30+
* from script.
3131
*
3232
* @author elwood
3333
*/
@@ -42,9 +42,8 @@ public ParamObjectAdapter(Object paramObject, ArrayList generatedParams) {
4242
}
4343

4444
/**
45-
* Puts the additional parameter into adapter, it will be available if no
46-
* existing property with same key exists. For example, it is suitable to add
47-
* custom objects and directives into dataContext.
45+
* Puts the additional parameter into adapter, it will be available if no existing property with same key exists. For
46+
* example, it is suitable to add custom objects and directives into dataContext.
4847
*/
4948
public void putAdditionalParam(String key, TemplateModel value) {
5049
if (additionalParams == null) {

src/test/java/org/mybatis/scripting/freemarker/NameMapper.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2015-2017 the original author or authors.
2+
* Copyright 2015-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -42,28 +42,27 @@ public interface NameMapper {
4242
Name findName(@Param("name") String name);
4343

4444
/**
45-
* If any whitespace found inside @Select text, it is interpreted as inline script, not template name.
46-
* It is convenient to avoid creating templates when script is really small.
45+
* If any whitespace found inside @Select text, it is interpreted as inline script, not template name. It is
46+
* convenient to avoid creating templates when script is really small.
4747
*/
4848
@Lang(FreeMarkerLanguageDriver.class)
4949
@Select("select * from names where id in (${ids?join(',')})")
5050
List<Name> findNamesByIds(@Param("ids") List<Integer> ids);
5151

5252
/**
53-
* There are no @Param annotation on argument. This means NameParam instance
54-
* will be passed into driver as is, not as Map entry. So, we need to support this case.
55-
* Because in driver we need to add some another properties into template model,
56-
* and NameParam is not Map, we are need to wrap passed parameter object into
53+
* There are no @Param annotation on argument. This means NameParam instance will be passed into driver as is, not as
54+
* Map entry. So, we need to support this case. Because in driver we need to add some another properties into template
55+
* model, and NameParam is not Map, we are need to wrap passed parameter object into
5756
* {@link org.mybatis.scripting.freemarker.ParamObjectAdapter} before processing template.
5857
*/
5958
@Lang(FreeMarkerLanguageDriver.class)
6059
@Select("select * from names where id = <@p name='id'/> and id = ${id}")
6160
Name find(NameParam nameParam);
6261

6362
/**
64-
* This query is to demonstrate MyBatis odd behaviour when using String as parameter
65-
* and can use properties that not exist. Both props will be use provided `name` parameter value.
66-
* Goal is to write FreeMarker lang plugin to support this behaviour too (although it is confusing one).
63+
* This query is to demonstrate MyBatis odd behaviour when using String as parameter and can use properties that not
64+
* exist. Both props will be use provided `name` parameter value. Goal is to write FreeMarker lang plugin to support
65+
* this behaviour too (although it is confusing one).
6766
*/
6867
@Select("select * from names" + " where firstName = #{noSuchPropertyOnString}"
6968
+ " or firstName = #{oneMoreUnexistingProperty}")

src/test/java/org/mybatis/scripting/freemarker/PreparedParamsMapper.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2015-2017 the original author or authors.
2+
* Copyright 2015-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,8 +22,7 @@
2222
import java.util.List;
2323

2424
/**
25-
* This mapper demonstrates the usage of auto-generating prepared statement
26-
* parameters instead of usual inline strategy.
25+
* This mapper demonstrates the usage of auto-generating prepared statement parameters instead of usual inline strategy.
2726
*
2827
* @author elwood
2928
*/
@@ -33,9 +32,8 @@ public interface PreparedParamsMapper {
3332
List<Name> findByNames(@Param("ids") List<String> ids);
3433

3534
/**
36-
* This is doesn't work - because params objects are unsupported when using
37-
* auto-generated prepared parameters (it is impossible to add parameters
38-
* to MyBatis engine). This call will throw exception.
35+
* This is doesn't work - because params objects are unsupported when using auto-generated prepared parameters (it is
36+
* impossible to add parameters to MyBatis engine). This call will throw exception.
3937
*/
4038
@Lang(FreeMarkerLanguageDriver.class)
4139
@Select("prepared.ftl")

0 commit comments

Comments
 (0)