Skip to content

Commit 9a6c49a

Browse files
authored
Merge pull request #3358 from hazendaz/pom-cleanup
Additoinal Cleanup on formatting blocks
2 parents 9297887 + 45dc487 commit 9a6c49a

File tree

15 files changed

+117
-122
lines changed

15 files changed

+117
-122
lines changed

src/main/java/org/apache/ibatis/annotations/DeleteProvider.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
* Since 3.5.1, this attribute can omit.
7979
* <p>
8080
* If this attribute omit, the MyBatis will call a method that decide by following rules. <code>
81-
* <pre>
8281
* <ul>
8382
* <li>
8483
* If class that specified the {@link #type()} attribute implements the
@@ -91,7 +90,6 @@
9190
* and use a fallback method that named {@code provideSql} from specified type
9291
* </li>
9392
* </ul>
94-
* </pre>
9593
* </code>
9694
*
9795
* @return a method name of method for providing an SQL

src/main/java/org/apache/ibatis/annotations/InsertProvider.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
* Since 3.5.1, this attribute can omit.
7979
* <p>
8080
* If this attribute omit, the MyBatis will call a method that decide by following rules. <code>
81-
* <pre>
8281
* <ul>
8382
* <li>
8483
* If class that specified the {@link #type()} attribute implements the
@@ -91,7 +90,6 @@
9190
* and use a fallback method that named {@code provideSql} from specified type
9291
* </li>
9392
* </ul>
94-
* </pre>
9593
* </code>
9694
*
9795
* @return a method name of method for providing an SQL

src/main/java/org/apache/ibatis/annotations/SelectProvider.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
* Since 3.5.1, this attribute can omit.
7979
* <p>
8080
* If this attribute omit, the MyBatis will call a method that decide by following rules. <code>
81-
* <pre>
8281
* <ul>
8382
* <li>
8483
* If class that specified the {@link #type()} attribute implements the
@@ -89,9 +88,8 @@
8988
* If cannot resolve a method by {@link org.apache.ibatis.builder.annotation.ProviderMethodResolver}
9089
* (= not implement it or it was returned {@code null}), the MyBatis will search
9190
* and use a fallback method that named {@code provideSql} from specified type.
92-
* </li>
91+
* </li>
9392
* </ul>
94-
* </pre>
9593
* </code>
9694
*
9795
* @return a method name of method for providing an SQL

src/main/java/org/apache/ibatis/annotations/UpdateProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
* If cannot resolve a method by {@link org.apache.ibatis.builder.annotation.ProviderMethodResolver}
9090
* (= not implement it or it was returned {@code null}), the MyBatis will search and use a fallback method
9191
* that named {@code provideSql} from specified type</li>
92-
* </ul>
92+
* </ul>
9393
* </code>
9494
*
9595
* @return a method name of method for providing an SQL

src/test/java/org/apache/ibatis/binding/BoundAuthorMapper.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,8 @@ public interface BoundAuthorMapper {
5454

5555
// ======================================================
5656

57+
@ConstructorArgs({ @Arg(column = "AUTHOR_ID", javaType = int.class) })
5758
// @formatter:off
58-
@ConstructorArgs({
59-
@Arg(column = "AUTHOR_ID", javaType = int.class)
60-
})
6159
@Results({
6260
@Result(property = "username", column = "AUTHOR_USERNAME"),
6361
@Result(property = "password", column = "AUTHOR_PASSWORD"),
@@ -179,11 +177,9 @@ public interface BoundAuthorMapper {
179177

180178
// ======================================================
181179

182-
// @formatter:off
183-
@Results(
184-
@Result(property = "id", column = "AUTHOR_ID")
185-
)
180+
@Results(@Result(property = "id", column = "AUTHOR_ID"))
186181
@Result(property = "username", column = "AUTHOR_USERNAME")
182+
// @formatter:off
187183
@Select({
188184
"SELECT ",
189185
" ID as AUTHOR_ID,",

src/test/java/org/apache/ibatis/binding/BoundBlogMapper.java

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,8 @@ public interface BoundBlogMapper {
125125
// ======================================================
126126

127127
@Select("SELECT * FROM post ORDER BY id")
128+
@Results({ @Result(id = true, property = "id", column = "id") })
128129
// @formatter:off
129-
@Results({
130-
@Result(id = true, property = "id", column = "id")
131-
})
132130
@TypeDiscriminator(
133131
column = "draft",
134132
javaType = int.class,
@@ -149,8 +147,8 @@ public interface BoundBlogMapper {
149147
// ======================================================
150148

151149
// @formatter:off
152-
@Select("SELECT * FROM "
153-
+ "blog WHERE id = #{id}")
150+
@Select("SELECT * FROM blog "
151+
+ "WHERE id = #{id}")
154152
@ConstructorArgs({
155153
@Arg(column = "id", javaType = int.class, id = true),
156154
@Arg(column = "title", javaType = String.class),
@@ -171,47 +169,47 @@ public interface BoundBlogMapper {
171169
// ======================================================
172170

173171
// @formatter:off
174-
@Select("SELECT * FROM "
175-
+ "blog WHERE id = #{id}")
172+
@Select("SELECT * FROM blog "
173+
+ "WHERE id = #{id}")
176174
// @formatter:on
177175
Map<String, Object> selectBlogAsMap(Map<String, Object> params);
178176

179177
// ======================================================
180178

181179
// @formatter:off
182-
@Select("SELECT * FROM "
183-
+ "post WHERE subject like #{query}")
180+
@Select("SELECT * FROM post "
181+
+ "WHERE subject like #{query}")
184182
// @formatter:on
185183
List<Post> selectPostsLike(RowBounds bounds, String query);
186184

187185
// ======================================================
188186

189187
// @formatter:off
190-
@Select("SELECT * FROM "
191-
+ "post WHERE subject like #{subjectQuery} and body like #{bodyQuery}")
188+
@Select("SELECT * FROM post "
189+
+ "WHERE subject like #{subjectQuery} and body like #{bodyQuery}")
192190
// @formatter:on
193191
List<Post> selectPostsLikeSubjectAndBody(RowBounds bounds, @Param("subjectQuery") String subjectQuery,
194192
@Param("bodyQuery") String bodyQuery);
195193

196194
// ======================================================
197195

198196
// @formatter:off
199-
@Select("SELECT * FROM "
200-
+ "post WHERE id = #{id}")
197+
@Select("SELECT * FROM post "
198+
+ "WHERE id = #{id}")
201199
// @formatter:on
202200
List<Post> selectPostsById(int id);
203201

204202
// ======================================================
205203

206204
// @formatter:off
207205
@Select("SELECT * FROM blog "
208-
+ "WHERE id = #{id} AND title = #{nonExistentParam,jdbcType=VARCHAR}")
206+
+ "WHERE id = #{id} AND title = #{nonExistentParam,jdbcType=VARCHAR}")
209207
// @formatter:on
210208
Blog selectBlogByNonExistentParam(@Param("id") int id);
211209

212210
// @formatter:off
213211
@Select("SELECT * FROM blog "
214-
+ "WHERE id = #{id} AND title = #{params.nonExistentParam,jdbcType=VARCHAR}")
212+
+ "WHERE id = #{id} AND title = #{params.nonExistentParam,jdbcType=VARCHAR}")
215213
// @formatter:on
216214
Blog selectBlogByNonExistentNestedParam(@Param("id") int id, @Param("params") Map<String, Object> params);
217215

@@ -222,21 +220,21 @@ List<Post> selectPostsLikeSubjectAndBody(RowBounds bounds, @Param("subjectQuery"
222220

223221
// @formatter:off
224222
@Select("SELECT * FROM blog "
225-
+ "WHERE id = #{0} AND title = #{1}")
223+
+ "WHERE id = #{0} AND title = #{1}")
226224
// @formatter:on
227225
Blog selectBlogByDefault30ParamNames(int id, String title);
228226

229227
// @formatter:off
230228
@Select("SELECT * FROM blog "
231-
+ "WHERE id = #{param1} AND title = #{param2}")
229+
+ "WHERE id = #{param1} AND title = #{param2}")
232230
// @formatter:on
233231
Blog selectBlogByDefault31ParamNames(int id, String title);
234232

235233
// ======================================================
236234

237235
// @formatter:off
238236
@Select("SELECT * FROM blog "
239-
+ "WHERE ${column} = #{id} AND title = #{value}")
237+
+ "WHERE ${column} = #{id} AND title = #{value}")
240238
// @formatter:on
241239
Blog selectBlogWithAParamNamedValue(@Param("column") String column, @Param("id") int id,
242240
@Param("value") String title);
@@ -246,7 +244,7 @@ Blog selectBlogWithAParamNamedValue(@Param("column") String column, @Param("id")
246244
// @formatter:off
247245
@Select({
248246
"SELECT *",
249-
"FROM blog"
247+
"FROM blog"
250248
})
251249
@Results({
252250
@Result(property = "author", column = "author_id", one = @One(select = "org.apache.ibatis.binding.BoundAuthorMapper.selectAuthor")),
@@ -258,7 +256,7 @@ Blog selectBlogWithAParamNamedValue(@Param("column") String column, @Param("id")
258256
// @formatter:off
259257
@Select({
260258
"SELECT *",
261-
"FROM blog"
259+
"FROM blog"
262260
})
263261
@Results({
264262
@Result(property = "author", column = "author_id", one = @One(select = "org.apache.ibatis.binding.BoundAuthorMapper.selectAuthor", fetchType = FetchType.EAGER)),

src/test/java/org/apache/ibatis/binding/MapperWithOneAndMany.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2023 the original author or authors.
2+
* Copyright 2009-2024 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.
@@ -29,7 +29,7 @@ public interface MapperWithOneAndMany {
2929
// @formatter:off
3030
@Select({
3131
"SELECT *",
32-
"FROM blog"
32+
"FROM blog"
3333
})
3434
@Results({
3535
@Result(

src/test/java/org/apache/ibatis/reflection/TypeParameterResolverTest.java

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,24 @@ void shouldTypeVariablesBeComparedWithEquals() throws Exception {
473473
executor.shutdown();
474474
}
475475

476-
// @formatter:off
477-
class AA {}
478-
class BB {}
479-
interface IfaceA extends ParentIface<AA> {}
480-
interface IfaceB extends ParentIface<BB> {}
481-
interface ParentIface<T> {List<T> m();}
482-
// @formatter:on
476+
class AA {
477+
// Do nothing
478+
}
479+
480+
class BB {
481+
// Do nothing
482+
}
483+
484+
interface IfaceA extends ParentIface<AA> {
485+
// Do Nothing
486+
}
487+
488+
interface IfaceB extends ParentIface<BB> {
489+
// Do Nothing
490+
}
491+
492+
interface ParentIface<T> {
493+
List<T> m();
494+
}
495+
483496
}

src/test/java/org/apache/ibatis/session/AutoMappingUnknownColumnBehaviorTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
*/
4444
class AutoMappingUnknownColumnBehaviorTest {
4545

46-
// @formatter:off
4746
interface Mapper {
47+
// @formatter:off
4848
@Select({
4949
"SELECT ",
5050
" ID,",
@@ -54,17 +54,19 @@ interface Mapper {
5454
" BIO",
5555
"FROM AUTHOR WHERE ID = #{id}"
5656
})
57+
// @formatter:on
5758
Author selectAuthor(int id);
5859

60+
// @formatter:off
5961
@Select({
6062
"SELECT ",
6163
" ID,", // unknown property type
6264
" USERNAME",
6365
"FROM AUTHOR WHERE ID = #{id}"
6466
})
67+
// @formatter:on
6568
SimpleAuthor selectSimpleAuthor(int id);
6669
}
67-
// @formatter:on
6870

6971
static class SimpleAuthor {
7072
private AtomicInteger id; // unknown property type

src/test/java/org/apache/ibatis/submitted/annotion_many_one_add_columnprefix/UserDao.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2023 the original author or authors.
2+
* Copyright 2009-2024 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.
@@ -69,8 +69,8 @@ public interface UserDao {
6969
// @formatter:on
7070
List<User> findAll3();
7171

72-
// @formatter:off
7372
@Select("select id teacher_id, username teacher_name from user")
73+
// @formatter:off
7474
@Results(id = "userMap", value = {
7575
@Result(id = true, column = "teacher_id", property = "id"),
7676
@Result(column = "teacher_name", property = "username")

src/test/java/org/apache/ibatis/submitted/annotion_many_one_add_resultmapid/UserDao.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2023 the original author or authors.
2+
* Copyright 2009-2024 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.
@@ -69,8 +69,8 @@ public interface UserDao {
6969
// @formatter:on
7070
List<User> findAll3();
7171

72-
// @formatter:off
7372
@Select("select id teacher_id, username teacher_name from user")
73+
// @formatter:off
7474
@Results(id = "userMap", value = {
7575
@Result(id = true, column = "teacher_id", property = "id"),
7676
@Result(column = "teacher_name", property = "username")

0 commit comments

Comments
 (0)