Skip to content

Commit 7f3a9b1

Browse files
committed
reformat codes
1 parent 21e7b06 commit 7f3a9b1

66 files changed

Lines changed: 6216 additions & 6230 deletions

File tree

Some content is hidden

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

codes/javalib/bean/pom.xml

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,44 @@
11
<?xml version="1.0"?>
22
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0">
4-
<modelVersion>4.0.0</modelVersion>
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
4+
xmlns="http://maven.apache.org/POM/4.0.0">
5+
<modelVersion>4.0.0</modelVersion>
56

6-
<groupId>io.github.dunwu.javalib</groupId>
7-
<artifactId>javalib-bean</artifactId>
8-
<version>1.0.0</version>
9-
<packaging>jar</packaging>
10-
<name>JavaLib Demos - Bean</name>
11-
<description>javalib 之JavaBean库示例集锦</description>
7+
<groupId>io.github.dunwu.javalib</groupId>
8+
<artifactId>javalib-bean</artifactId>
9+
<version>1.0.0</version>
10+
<packaging>jar</packaging>
11+
<name>JavaLib Demos - Bean</name>
12+
<description>javalib 之JavaBean库示例集锦</description>
1213

13-
<properties>
14-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15-
<java.version>1.8</java.version>
16-
<maven.compiler.source>${java.version}</maven.compiler.source>
17-
<maven.compiler.target>${java.version}</maven.compiler.target>
18-
</properties>
14+
<properties>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
<java.version>1.8</java.version>
17+
<maven.compiler.source>${java.version}</maven.compiler.source>
18+
<maven.compiler.target>${java.version}</maven.compiler.target>
19+
</properties>
1920

20-
<dependencies>
21-
<dependency>
22-
<groupId>org.projectlombok</groupId>
23-
<artifactId>lombok</artifactId>
24-
<version>1.16.8</version>
25-
</dependency>
26-
<dependency>
27-
<groupId>junit</groupId>
28-
<artifactId>junit</artifactId>
29-
<version>4.12</version>
30-
<scope>test</scope>
31-
</dependency>
32-
</dependencies>
21+
<dependencies>
22+
<dependency>
23+
<groupId>org.projectlombok</groupId>
24+
<artifactId>lombok</artifactId>
25+
<version>1.16.8</version>
26+
</dependency>
27+
<dependency>
28+
<groupId>junit</groupId>
29+
<artifactId>junit</artifactId>
30+
<version>4.12</version>
31+
<scope>test</scope>
32+
</dependency>
33+
</dependencies>
3334

34-
<build>
35-
<resources>
36-
<resource>
37-
<filtering>true</filtering>
38-
<directory>src/main/resources</directory>
39-
</resource>
40-
</resources>
41-
</build>
35+
<build>
36+
<resources>
37+
<resource>
38+
<filtering>true</filtering>
39+
<directory>src/main/resources</directory>
40+
</resource>
41+
</resources>
42+
</build>
4243

4344
</project>
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
package io.github.dunwu.javalib.bean;
22

3-
import lombok.Data;
4-
53
import java.util.List;
4+
import lombok.Data;
65

76
/**
87
* Lombok 示例
98
*
10-
* @see http://jnb.ociweb.com/jnb/jnbJan2010.html
119
* @author Zhang Peng
10+
* @see http://jnb.ociweb.com/jnb/jnbJan2010.html
1211
*/
1312
@Data(staticConstructor = "of")
1413
public class Company {
1514

1615
private final Person founder;
16+
1717
protected List<Person> employees;
18+
1819
private String name;
1920

2021
}

codes/javalib/bean/src/main/java/io/github/dunwu/javalib/bean/Person.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
/**
88
* Lombok 示例
99
*
10-
* @see http://jnb.ociweb.com/jnb/jnbJan2010.html
1110
* @author Zhang Peng
11+
* @see http://jnb.ociweb.com/jnb/jnbJan2010.html
1212
*/
1313
@Data
1414
@ToString(exclude = "age")
15-
@EqualsAndHashCode(exclude = { "age", "sex" })
15+
@EqualsAndHashCode(exclude = {"age", "sex"})
1616
public class Person {
1717

1818
private String name;

codes/javalib/bean/src/test/java/io/github/dunwu/javalib/bean/LombokTest.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
package io.github.dunwu.javalib.bean;
22

3-
import lombok.Cleanup;
4-
import org.junit.Assert;
5-
import org.junit.Test;
6-
73
import java.io.ByteArrayOutputStream;
84
import java.io.IOException;
95
import java.util.ArrayList;
106
import java.util.List;
7+
import lombok.Cleanup;
8+
import org.junit.Assert;
9+
import org.junit.Test;
1110

1211
/**
1312
* Lombok 单元测试
1413
*
15-
* @see @see http://jnb.ociweb.com/jnb/jnbJan2010.html
1614
* @author Zhang Peng
15+
* @see @see http://jnb.ociweb.com/jnb/jnbJan2010.html
1716
*/
1817
public class LombokTest {
1918

@@ -53,10 +52,9 @@ public void testCleanUp() {
5352
try {
5453
@Cleanup
5554
ByteArrayOutputStream baos = new ByteArrayOutputStream();
56-
baos.write(new byte[] { 'Y', 'e', 's' });
55+
baos.write(new byte[] {'Y', 'e', 's'});
5756
System.out.println(baos.toString());
58-
}
59-
catch (IOException e) {
57+
} catch (IOException e) {
6058
e.printStackTrace();
6159
}
6260
}

codes/javalib/bean/src/test/java/io/github/dunwu/javalib/test/JUnitTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.github.dunwu.javalib.test;
22

3-
import org.junit.*;
43
import org.junit.runners.MethodSorters;
54

65
/**
@@ -20,8 +19,7 @@ public static void beforeClass() {
2019
}
2120

2221
/**
23-
* 当需要执行所有的测试在JUnit测试用例类后执行,@AfterClass注解可以使用以清理建立方法,(从数据库如断开连接)。
24-
* 注意:附有此批注(类似于BeforeClass)的方法必须定义为静态。
22+
* 当需要执行所有的测试在JUnit测试用例类后执行,@AfterClass注解可以使用以清理建立方法,(从数据库如断开连接)。 注意:附有此批注(类似于BeforeClass)的方法必须定义为静态。
2523
*/
2624
@AfterClass
2725
public static void afterClass() {
@@ -54,7 +52,7 @@ public void testB() {
5452
}
5553

5654
/**
57-
* @After 注解修饰的方法在执行每项测试后执行(如执行每一个测试后重置某些变量删除临时变量等)
55+
* @After 注解修饰的方法在执行每项测试后执行(如执行每一个测试后重置某些变量删除临时变量等)
5856
*/
5957
@After
6058
public void after() {

codes/javalib/json/pom.xml

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,48 @@
11
<?xml version="1.0"?>
22
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0">
4-
<modelVersion>4.0.0</modelVersion>
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
4+
xmlns="http://maven.apache.org/POM/4.0.0">
5+
<modelVersion>4.0.0</modelVersion>
56

6-
<groupId>io.github.dunwu.javalib</groupId>
7-
<artifactId>javalib-json</artifactId>
8-
<version>1.0.0</version>
9-
<packaging>jar</packaging>
10-
<name>JavaLib Demos - Json</name>
7+
<groupId>io.github.dunwu.javalib</groupId>
8+
<artifactId>javalib-json</artifactId>
9+
<version>1.0.0</version>
10+
<packaging>jar</packaging>
11+
<name>JavaLib Demos - Json</name>
1112

12-
<properties>
13-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14-
<java.version>1.8</java.version>
15-
<maven.compiler.source>${java.version}</maven.compiler.source>
16-
<maven.compiler.target>${java.version}</maven.compiler.target>
17-
</properties>
13+
<properties>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
<java.version>1.8</java.version>
16+
<maven.compiler.source>${java.version}</maven.compiler.source>
17+
<maven.compiler.target>${java.version}</maven.compiler.target>
18+
</properties>
1819

19-
<dependencies>
20-
<dependency>
21-
<groupId>com.alibaba</groupId>
22-
<artifactId>fastjson</artifactId>
23-
<version>1.2.56</version>
24-
</dependency>
25-
<dependency>
26-
<groupId>com.fasterxml.jackson.core</groupId>
27-
<artifactId>jackson-databind</artifactId>
28-
<version>2.9.8</version>
29-
</dependency>
30-
<dependency>
31-
<groupId>junit</groupId>
32-
<artifactId>junit</artifactId>
33-
<version>4.12</version>
34-
<scope>test</scope>
35-
</dependency>
36-
</dependencies>
20+
<dependencies>
21+
<dependency>
22+
<groupId>com.alibaba</groupId>
23+
<artifactId>fastjson</artifactId>
24+
<version>1.2.56</version>
25+
</dependency>
26+
<dependency>
27+
<groupId>com.fasterxml.jackson.core</groupId>
28+
<artifactId>jackson-databind</artifactId>
29+
<version>2.9.8</version>
30+
</dependency>
31+
<dependency>
32+
<groupId>junit</groupId>
33+
<artifactId>junit</artifactId>
34+
<version>4.12</version>
35+
<scope>test</scope>
36+
</dependency>
37+
</dependencies>
3738

38-
<build>
39-
<resources>
40-
<resource>
41-
<filtering>true</filtering>
42-
<directory>src/main/resources</directory>
43-
</resource>
44-
</resources>
45-
</build>
39+
<build>
40+
<resources>
41+
<resource>
42+
<filtering>true</filtering>
43+
<directory>src/main/resources</directory>
44+
</resource>
45+
</resources>
46+
</build>
4647

4748
</project>

codes/javalib/json/src/test/java/io/github/dunwu/javalib/json/fastjson/FastjsonAnnotationBean.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
package io.github.dunwu.javalib.json.fastjson;
22

33
import com.alibaba.fastjson.annotation.JSONField;
4-
54
import java.util.Date;
65

76
/**
87
* @author Zhang Peng
9-
* @date 2019-03-18
8+
* @since 2019-03-18
109
*/
1110
public class FastjsonAnnotationBean {
1211

codes/javalib/json/src/test/java/io/github/dunwu/javalib/json/fastjson/FastjsonTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22

33
import com.alibaba.fastjson.JSON;
44
import io.github.dunwu.javalib.json.Person;
5+
import java.util.Date;
56
import org.junit.Assert;
67
import org.junit.Test;
78

8-
import java.util.Date;
9-
109
/**
1110
* Fastjson 使用示例
1211
*
1312
* @author Zhang Peng
14-
* @date 2019-03-18
13+
* @since 2019-03-18
1514
*/
1615
public class FastjsonTests {
1716

codes/javalib/json/src/test/java/io/github/dunwu/javalib/json/jackson/JacksonAnnotationBean.java

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

77
/**
88
* @author Zhang Peng
9-
* @date 2019-03-18
9+
* @since 2019-03-18
1010
*/
1111
@JsonPropertyOrder(alphabetic = true)
1212
public class JacksonAnnotationBean {

codes/javalib/json/src/test/java/io/github/dunwu/javalib/json/jackson/JacksonTests.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@
33
import com.fasterxml.jackson.core.JsonProcessingException;
44
import com.fasterxml.jackson.databind.ObjectMapper;
55
import io.github.dunwu.javalib.json.Person;
6-
import org.junit.Assert;
7-
import org.junit.Test;
8-
96
import java.io.IOException;
107
import java.util.HashMap;
118
import java.util.LinkedList;
129
import java.util.List;
1310
import java.util.Map;
11+
import org.junit.Assert;
12+
import org.junit.Test;
1413

1514
/**
1615
* Jackson 使用示例
1716
*
1817
* @author Zhang Peng
19-
* @date 2019-03-18
18+
* @since 2019-03-18
2019
*/
2120
public class JacksonTests {
2221

@@ -31,8 +30,7 @@ public void serialize() {
3130
String json = null;
3231
try {
3332
json = mapper.writeValueAsString(p);
34-
}
35-
catch (JsonProcessingException e) {
33+
} catch (JsonProcessingException e) {
3634
e.printStackTrace();
3735
}
3836
Assert.assertNotNull(json);
@@ -48,8 +46,7 @@ public void deserialize() {
4846
Person p = null;
4947
try {
5048
p = mapper.readValue(json, Person.class);
51-
}
52-
catch (IOException e) {
49+
} catch (IOException e) {
5350
e.printStackTrace();
5451
}
5552
Assert.assertNotNull(p);
@@ -76,8 +73,7 @@ public void serialize2() {
7673
String json = null;
7774
try {
7875
json = mapper.writeValueAsString(map);
79-
}
80-
catch (JsonProcessingException e) {
76+
} catch (JsonProcessingException e) {
8177
e.printStackTrace();
8278
}
8379

@@ -94,8 +90,7 @@ public void serialize3() {
9490
String json = null;
9591
try {
9692
json = mapper.writeValueAsString(jacksonAnnotationBean);
97-
}
98-
catch (JsonProcessingException e) {
93+
} catch (JsonProcessingException e) {
9994
e.printStackTrace();
10095
}
10196
Assert.assertNotNull(json);

0 commit comments

Comments
 (0)