Skip to content

Commit 55cfb7d

Browse files
authored
Merge pull request #2791 from hazendaz/formatting
[ci] Formatting
2 parents 312b4ff + 5d8db22 commit 55cfb7d

File tree

80 files changed

+923
-834
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+923
-834
lines changed

src/test/java/org/apache/ibatis/submitted/dynsql/DynSqlTest.java

+42-30
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2023 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.
@@ -51,7 +51,7 @@ static void setUp() throws Exception {
5151
}
5252

5353
BaseDataTest.runScript(sqlSessionFactory.getConfiguration().getEnvironment().getDataSource(),
54-
"org/apache/ibatis/submitted/dynsql/CreateDB.sql");
54+
"org/apache/ibatis/submitted/dynsql/CreateDB.sql");
5555
}
5656

5757
@Test
@@ -84,7 +84,8 @@ void testSelectSimple() {
8484
parameter.setSchema("ibtest");
8585
parameter.setIds(ids);
8686

87-
List<Map<String, Object>> answer = sqlSession.selectList("org.apache.ibatis.submitted.dynsql.select_simple", parameter);
87+
List<Map<String, Object>> answer = sqlSession.selectList("org.apache.ibatis.submitted.dynsql.select_simple",
88+
parameter);
8889

8990
assertEquals(3, answer.size());
9091
}
@@ -126,7 +127,8 @@ void testNumerics() {
126127
@Test
127128
void testOgnlStaticMethodCall() {
128129
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
129-
List<Map<String, Object>> answer = sqlSession.selectList("org.apache.ibatis.submitted.dynsql.ognlStaticMethodCall", "Rock 'n Roll");
130+
List<Map<String, Object>> answer = sqlSession
131+
.selectList("org.apache.ibatis.submitted.dynsql.ognlStaticMethodCall", "Rock 'n Roll");
130132
assertEquals(1, answer.size());
131133
assertEquals(7, answer.get(0).get("ID"));
132134
}
@@ -142,8 +144,9 @@ void testBindNull() {
142144
}
143145

144146
/**
145-
* Verify that can specify any variable name for parameter object when parameter is value object that a type handler exists.
146-
*
147+
* Verify that can specify any variable name for parameter object when parameter is value object that a type handler
148+
* exists.
149+
* <p>
147150
* https://github.com/mybatis/mybatis-3/issues/1486
148151
*/
149152
@Test
@@ -181,7 +184,9 @@ void testNonValueObjectWithoutParamAnnotation() {
181184
try {
182185
mapper.selectDescriptionByConditions2(conditions);
183186
} catch (PersistenceException e) {
184-
assertEquals("There is no getter for property named 'conditions' in 'class org.apache.ibatis.submitted.dynsql.DynSqlMapper$Conditions'", e.getCause().getMessage());
187+
assertEquals(
188+
"There is no getter for property named 'conditions' in 'class org.apache.ibatis.submitted.dynsql.DynSqlMapper$Conditions'",
189+
e.getCause().getMessage());
185190
}
186191
assertEquals(7, mapper.selectDescriptionByConditions2(null).size());
187192
}
@@ -192,7 +197,9 @@ void testNonValueObjectWithoutParamAnnotation() {
192197
try {
193198
mapper.selectDescriptionByConditions3(conditions);
194199
} catch (PersistenceException e) {
195-
assertEquals("There is no getter for property named 'conditions' in 'class org.apache.ibatis.submitted.dynsql.DynSqlMapper$Conditions'", e.getCause().getMessage());
200+
assertEquals(
201+
"There is no getter for property named 'conditions' in 'class org.apache.ibatis.submitted.dynsql.DynSqlMapper$Conditions'",
202+
e.getCause().getMessage());
196203
}
197204
assertEquals(7, mapper.selectDescriptionByConditions3(null).size());
198205
}
@@ -208,28 +215,33 @@ void testCustomValueObjectWithoutParamAnnotation() throws IOException {
208215
try (Reader configReader = Resources.getResourceAsReader("org/apache/ibatis/submitted/dynsql/MapperConfig.xml")) {
209216
sqlSessionFactory = new SqlSessionFactoryBuilder().build(configReader);
210217
// register type handler for the user defined class (= value object)
211-
sqlSessionFactory.getConfiguration().getTypeHandlerRegistry().register(DynSqlMapper.Conditions.class, new TypeHandler<DynSqlMapper.Conditions>() {
212-
@Override
213-
public void setParameter(PreparedStatement ps, int i, DynSqlMapper.Conditions parameter, JdbcType jdbcType) throws SQLException {
214-
if (parameter.getId() != null) {
215-
ps.setInt(i, parameter.getId());
216-
} else {
217-
ps.setNull(i, JdbcType.INTEGER.TYPE_CODE);
218-
}
219-
}
220-
@Override
221-
public DynSqlMapper.Conditions getResult(ResultSet rs, String columnName) throws SQLException {
222-
return null;
223-
}
224-
@Override
225-
public DynSqlMapper.Conditions getResult(ResultSet rs, int columnIndex) throws SQLException {
226-
return null;
227-
}
228-
@Override
229-
public DynSqlMapper.Conditions getResult(CallableStatement cs, int columnIndex) throws SQLException {
230-
return null;
231-
}
232-
});
218+
sqlSessionFactory.getConfiguration().getTypeHandlerRegistry().register(DynSqlMapper.Conditions.class,
219+
new TypeHandler<DynSqlMapper.Conditions>() {
220+
@Override
221+
public void setParameter(PreparedStatement ps, int i, DynSqlMapper.Conditions parameter, JdbcType jdbcType)
222+
throws SQLException {
223+
if (parameter.getId() != null) {
224+
ps.setInt(i, parameter.getId());
225+
} else {
226+
ps.setNull(i, JdbcType.INTEGER.TYPE_CODE);
227+
}
228+
}
229+
230+
@Override
231+
public DynSqlMapper.Conditions getResult(ResultSet rs, String columnName) throws SQLException {
232+
return null;
233+
}
234+
235+
@Override
236+
public DynSqlMapper.Conditions getResult(ResultSet rs, int columnIndex) throws SQLException {
237+
return null;
238+
}
239+
240+
@Override
241+
public DynSqlMapper.Conditions getResult(CallableStatement cs, int columnIndex) throws SQLException {
242+
return null;
243+
}
244+
});
233245
}
234246
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
235247
DynSqlMapper mapper = sqlSession.getMapper(DynSqlMapper.class);
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2023 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.
@@ -19,74 +19,94 @@
1919
import java.math.BigInteger;
2020

2121
public class NumericRow {
22-
private Integer id;
23-
private Byte tinynumber;
24-
private Short smallnumber;
25-
private Long longinteger;
26-
private BigInteger biginteger;
27-
private BigDecimal numericnumber;
28-
private BigDecimal decimalnumber;
29-
private Float realnumber;
30-
private Float floatnumber;
31-
private Double doublenumber;
32-
public Integer getId() {
33-
return id;
34-
}
35-
public void setId(Integer id) {
36-
this.id = id;
37-
}
38-
public Byte getTinynumber() {
39-
return tinynumber;
40-
}
41-
public void setTinynumber(Byte tinynumber) {
42-
this.tinynumber = tinynumber;
43-
}
44-
public Short getSmallnumber() {
45-
return smallnumber;
46-
}
47-
public void setSmallnumber(Short smallnumber) {
48-
this.smallnumber = smallnumber;
49-
}
50-
public Long getLonginteger() {
51-
return longinteger;
52-
}
53-
public void setLonginteger(Long longinteger) {
54-
this.longinteger = longinteger;
55-
}
56-
public BigInteger getBiginteger() {
57-
return biginteger;
58-
}
59-
public void setBiginteger(BigInteger biginteger) {
60-
this.biginteger = biginteger;
61-
}
62-
public BigDecimal getNumericnumber() {
63-
return numericnumber;
64-
}
65-
public void setNumericnumber(BigDecimal numericnumber) {
66-
this.numericnumber = numericnumber;
67-
}
68-
public BigDecimal getDecimalnumber() {
69-
return decimalnumber;
70-
}
71-
public void setDecimalnumber(BigDecimal decimalnumber) {
72-
this.decimalnumber = decimalnumber;
73-
}
74-
public Float getRealnumber() {
75-
return realnumber;
76-
}
77-
public void setRealnumber(Float realnumber) {
78-
this.realnumber = realnumber;
79-
}
80-
public Float getFloatnumber() {
81-
return floatnumber;
82-
}
83-
public void setFloatnumber(Float floatnumber) {
84-
this.floatnumber = floatnumber;
85-
}
86-
public Double getDoublenumber() {
87-
return doublenumber;
88-
}
89-
public void setDoublenumber(Double doublenumber) {
90-
this.doublenumber = doublenumber;
91-
}
22+
private Integer id;
23+
private Byte tinynumber;
24+
private Short smallnumber;
25+
private Long longinteger;
26+
private BigInteger biginteger;
27+
private BigDecimal numericnumber;
28+
private BigDecimal decimalnumber;
29+
private Float realnumber;
30+
private Float floatnumber;
31+
private Double doublenumber;
32+
33+
public Integer getId() {
34+
return id;
35+
}
36+
37+
public void setId(Integer id) {
38+
this.id = id;
39+
}
40+
41+
public Byte getTinynumber() {
42+
return tinynumber;
43+
}
44+
45+
public void setTinynumber(Byte tinynumber) {
46+
this.tinynumber = tinynumber;
47+
}
48+
49+
public Short getSmallnumber() {
50+
return smallnumber;
51+
}
52+
53+
public void setSmallnumber(Short smallnumber) {
54+
this.smallnumber = smallnumber;
55+
}
56+
57+
public Long getLonginteger() {
58+
return longinteger;
59+
}
60+
61+
public void setLonginteger(Long longinteger) {
62+
this.longinteger = longinteger;
63+
}
64+
65+
public BigInteger getBiginteger() {
66+
return biginteger;
67+
}
68+
69+
public void setBiginteger(BigInteger biginteger) {
70+
this.biginteger = biginteger;
71+
}
72+
73+
public BigDecimal getNumericnumber() {
74+
return numericnumber;
75+
}
76+
77+
public void setNumericnumber(BigDecimal numericnumber) {
78+
this.numericnumber = numericnumber;
79+
}
80+
81+
public BigDecimal getDecimalnumber() {
82+
return decimalnumber;
83+
}
84+
85+
public void setDecimalnumber(BigDecimal decimalnumber) {
86+
this.decimalnumber = decimalnumber;
87+
}
88+
89+
public Float getRealnumber() {
90+
return realnumber;
91+
}
92+
93+
public void setRealnumber(Float realnumber) {
94+
this.realnumber = realnumber;
95+
}
96+
97+
public Float getFloatnumber() {
98+
return floatnumber;
99+
}
100+
101+
public void setFloatnumber(Float floatnumber) {
102+
this.floatnumber = floatnumber;
103+
}
104+
105+
public Double getDoublenumber() {
106+
return doublenumber;
107+
}
108+
109+
public void setDoublenumber(Double doublenumber) {
110+
this.doublenumber = doublenumber;
111+
}
92112
}

src/test/java/org/apache/ibatis/submitted/dynsql2/DynSqlTest.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2023 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.
@@ -41,7 +41,7 @@ static void setUp() throws Exception {
4141
}
4242

4343
BaseDataTest.runScript(sqlSessionFactory.getConfiguration().getEnvironment().getDataSource(),
44-
"org/apache/ibatis/submitted/dynsql2/CreateDB.sql");
44+
"org/apache/ibatis/submitted/dynsql2/CreateDB.sql");
4545
}
4646

4747
@Test
@@ -62,7 +62,8 @@ void testDynamicSelectWithTypeHandler() {
6262
Parameter parameter = new Parameter();
6363
parameter.setNames(names);
6464

65-
List<Map<String, Object>> answer = sqlSession.selectList("org.apache.ibatis.submitted.dynsql2.dynamicSelectWithTypeHandler", parameter);
65+
List<Map<String, Object>> answer = sqlSession
66+
.selectList("org.apache.ibatis.submitted.dynsql2.dynamicSelectWithTypeHandler", parameter);
6667

6768
assertEquals(2, answer.size());
6869
}

src/test/java/org/apache/ibatis/submitted/dynsql2/FirstNameTypeHandler.java

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2023 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.
@@ -23,26 +23,22 @@
2323
public class FirstNameTypeHandler implements TypeHandler {
2424

2525
@Override
26-
public Object getResult(CallableStatement cs, int columnIndex)
27-
throws SQLException {
26+
public Object getResult(CallableStatement cs, int columnIndex) throws SQLException {
2827
return cs.getString(columnIndex);
2928
}
3029

3130
@Override
32-
public Object getResult(ResultSet rs, String columnName)
33-
throws SQLException {
31+
public Object getResult(ResultSet rs, String columnName) throws SQLException {
3432
return rs.getString(columnName);
3533
}
3634

3735
@Override
38-
public Object getResult(ResultSet rs, int columnIndex)
39-
throws SQLException {
36+
public Object getResult(ResultSet rs, int columnIndex) throws SQLException {
4037
return rs.getString(columnIndex);
4138
}
4239

4340
@Override
44-
public void setParameter(PreparedStatement ps, int i, Object parameter,
45-
JdbcType jdbcType) throws SQLException {
41+
public void setParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType) throws SQLException {
4642
if (parameter == null) {
4743
ps.setNull(i, Types.VARCHAR);
4844
} else {

src/test/java/org/apache/ibatis/submitted/dynsql2/LastNameTypeHandler.java

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2023 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.
@@ -23,26 +23,22 @@
2323
public class LastNameTypeHandler implements TypeHandler {
2424

2525
@Override
26-
public Object getResult(CallableStatement cs, int columnIndex)
27-
throws SQLException {
26+
public Object getResult(CallableStatement cs, int columnIndex) throws SQLException {
2827
return cs.getString(columnIndex);
2928
}
3029

3130
@Override
32-
public Object getResult(ResultSet rs, String columnName)
33-
throws SQLException {
31+
public Object getResult(ResultSet rs, String columnName) throws SQLException {
3432
return rs.getString(columnName);
3533
}
3634

3735
@Override
38-
public Object getResult(ResultSet rs, int columnIndex)
39-
throws SQLException {
36+
public Object getResult(ResultSet rs, int columnIndex) throws SQLException {
4037
return rs.getString(columnIndex);
4138
}
4239

4340
@Override
44-
public void setParameter(PreparedStatement ps, int i, Object parameter,
45-
JdbcType jdbcType) throws SQLException {
41+
public void setParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType) throws SQLException {
4642
if (parameter == null) {
4743
ps.setNull(i, Types.VARCHAR);
4844
} else {

0 commit comments

Comments
 (0)