Skip to content

Commit 36b9d36

Browse files
committed
0.9.3发布前最终优化代码;
1 parent 2463f5c commit 36b9d36

File tree

7 files changed

+23
-23
lines changed

7 files changed

+23
-23
lines changed

src/main/java/indi/mybatis/flying/models/TypeJdbcTypeConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
public class TypeJdbcTypeConverter {
1010

11-
protected final static Map<Class<?>, JdbcType> map = new HashMap<>(128);
11+
protected final static Map<Class<?>, JdbcType> map = new HashMap<>(8);
1212

1313
static {
1414
map.put(String.class, JdbcType.VARCHAR);

src/main/java/indi/mybatis/flying/utils/JdbcTypeEnum.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private JdbcTypeEnum(JdbcType jdbcType) {
5353
this.jdbcType = jdbcType;
5454
}
5555

56-
private static Map<String,JdbcType> nameLookup = new HashMap<>();
56+
private static final Map<String,JdbcType> nameLookup = new HashMap<>(64);
5757

5858
static {
5959
for (JdbcTypeEnum jdbcTypeEnum : JdbcTypeEnum.values()) {

src/test/java/indi/mybatis/flying/test/AccountTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void testDataSource() {
105105
@DatabaseTearDown(connection = "dataSource2", type = DatabaseOperation.DELETE_ALL, value = "/indi/mybatis/flying/test/accountTest/testInsert.datasource2.result.xml") })
106106
public void testInsert() {
107107
Account_ a = new Account_();
108-
a.setId(1l);
108+
a.setId(1L);
109109
a.setName("ann");
110110
a.setEmail("ann@live.cn");
111111
a.setPassword("5a690d842935c51f26f473e025c1b97a");

src/test/java/indi/mybatis/flying/test/AccountTypeHandlerTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public void testAccountTypeHandler() {
8181
Assert.assertEquals("ann@live.cn", longinLogSource.getAccount().getEmail());
8282

8383
Account_ ac = new Account_();
84-
ac.setId(1l);
84+
ac.setId(1L);
8585
LoginLogSource2 l2c = new LoginLogSource2();
8686
l2c.setAccount(ac);
8787
Collection<LoginLogSource2> loginLogSource2C = loginLogSource2Service.selectAll(l2c);
@@ -97,14 +97,14 @@ public void testAccountTypeHandler() {
9797
Assert.assertNull(loginLogSource3.getAccount());
9898

9999
Account_ ac2 = new Account_();
100-
ac2.setId(2l);
100+
ac2.setId(2L);
101101
LoginLogSource2 l2c2 = new LoginLogSource2();
102102
l2c2.setAccount(ac2);
103103
LoginLogSource2 loginLogSource4 = loginLogSource2Service.selectOne(l2c2);
104104
Assert.assertEquals("bob@live.cn", loginLogSource4.getAccount().getEmail());
105105

106106
Account_ ac3 = new Account_();
107-
ac3.setId(1l);
107+
ac3.setId(1L);
108108
LoginLogSource2 l2c3 = new LoginLogSource2();
109109
l2c3.setAccount(ac3);
110110
l2c3.setLoginIP("ip1");

src/test/java/indi/mybatis/flying/test/CacheTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,22 +210,22 @@ public void testPagination() {
210210
String name1 = "ann", name2 = "bob", name3 = "carl", name4 = "duke";
211211

212212
Account_ a1 = new Account_();
213-
a1.setId(1l);
213+
a1.setId(1L);
214214
a1.setName(name1);
215215
accountService.insert(a1);
216216

217217
Account_ a2 = new Account_();
218-
a2.setId(2l);
218+
a2.setId(2L);
219219
a2.setName(name2);
220220
accountService.insert(a2);
221221

222222
Account_ a3 = new Account_();
223-
a3.setId(3l);
223+
a3.setId(3L);
224224
a3.setName(name3);
225225
accountService.insert(a3);
226226

227227
Account_ a4 = new Account_();
228-
a4.setId(4l);
228+
a4.setId(4L);
229229
a4.setName(name4);
230230
accountService.insert(a4);
231231

@@ -569,7 +569,7 @@ public void testUpdateDirect() {
569569
r.setName("ann");
570570
roleService.insert(r);
571571
Account_ a = new Account_();
572-
a.setId(1l);
572+
a.setId(1L);
573573
a.setRole(r);
574574
a.setEmail("email");
575575
accountService.insert(a);
@@ -597,7 +597,7 @@ public void testUpdateDirect2() {
597597
r.setName("ann");
598598
roleService.insert(r);
599599
Account_ a = new Account_();
600-
a.setId(1l);
600+
a.setId(1L);
601601
a.setRole(r);
602602
a.setEmail("email");
603603
accountService.insert(a);
@@ -630,7 +630,7 @@ public void testUpdateDirect3() {
630630
r.setName("ann");
631631
roleService.insert(r);
632632
Account_ a = new Account_();
633-
a.setId(1l);
633+
a.setId(1L);
634634
a.setRole(r);
635635
a.setEmail("email");
636636
accountService.insert(a);
@@ -663,7 +663,7 @@ public void testUpdateDirect4() {
663663
r.setName("ann");
664664
roleService.insert(r);
665665
Account_ a = new Account_();
666-
a.setId(1l);
666+
a.setId(1L);
667667
a.setRole(r);
668668
a.setEmail("email");
669669
accountService.insert(a);
@@ -766,7 +766,7 @@ public void testSameIdAndInjectionInDifferentPojos() {
766766
roleService.insert(r);
767767

768768
Account_ a = new Account_();
769-
a.setId(1l);
769+
a.setId(1L);
770770
a.setName("deployer");
771771
accountService.insert(a);
772772

@@ -804,7 +804,7 @@ public void testSelectWithoutRole() {
804804
roleService.insert(r2);
805805

806806
Account_ a = new Account_();
807-
a.setId(1l);
807+
a.setId(1L);
808808
a.setRole(r);
809809
a.setRoleDeputy(r2);
810810
a.setName("deployer");

src/test/java/indi/mybatis/flying/test/OrTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public void testOr6() {
248248
public void testOr2() {
249249
LoginLog_Condition lc = new LoginLog_Condition();
250250
lc.setAccount(new Account_Condition());
251-
((Account_Condition) lc.getAccount()).setIdEqualsOr(1l, 2l);
251+
((Account_Condition) lc.getAccount()).setIdEqualsOr(1L, 2L);
252252
int i = loginLogService.count(lc);
253253
Assert.assertEquals(4, i);
254254
}
@@ -263,9 +263,9 @@ public void testOr7() {
263263
// loginLogSource2.setAccount(new Account_Condition());
264264
// ((Account_Condition)loginLogSource2.getAccount()).setIdEqualsOr(1,2);
265265
Account_ ac1 = new Account_();
266-
ac1.setId(1l);
266+
ac1.setId(1L);
267267
Account_ ac2 = new Account_();
268-
ac2.setId(2l);
268+
ac2.setId(2L);
269269
loginLogSource2.setAccountEqualsOr(ac1, ac2);
270270
int i = loginLogSource2Service.count(loginLogSource2);
271271
Assert.assertEquals(4, i);
@@ -286,9 +286,9 @@ public void testOr7() {
286286
public void testOrMashup() {
287287
LoginLogSource2Condition l2c = new LoginLogSource2Condition();
288288
Account_ a1 = new Account_();
289-
a1.setId(1l);
289+
a1.setId(1L);
290290
Account_ a2 = new Account_();
291-
a2.setId(2l);
291+
a2.setId(2L);
292292
l2c.setAccountEqualsOr2(a1, a2, "23453");
293293
int i1 = loginLogSource2Service.count(l2c);
294294
Assert.assertEquals(3, i1);

src/test/java/indi/mybatis/flying/test/ThreadTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public void testExampleThread() throws Throwable {
7373

7474
// 实例化 TestRunnable 类
7575
TestRunnable tr1, tr2;
76-
tr1 = new accountInsert(2l, "ann");
77-
tr2 = new accountInsert(3l, "ann");
76+
tr1 = new accountInsert(2L, "ann");
77+
tr2 = new accountInsert(3L, "ann");
7878
// 把实例传递给 MTTR
7979
TestRunnable[] trs = { tr1, tr2 };
8080
MultiThreadedTestRunner mttr = new MultiThreadedTestRunner(trs);

0 commit comments

Comments
 (0)