Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9335ac1

Browse filesBrowse files
committed
🆕上传 Jackson 代码啊
1 parent 5cd4902 commit 9335ac1
Copy full SHA for 9335ac1

File tree

Expand file treeCollapse file tree

8 files changed

+169
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

8 files changed

+169
-0
lines changed
Open diff view settings
Collapse file
+38Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
target/
2+
!.mvn/wrapper/maven-wrapper.jar
3+
!**/src/main/**/target/
4+
!**/src/test/**/target/
5+
6+
### IntelliJ IDEA ###
7+
.idea/modules.xml
8+
.idea/jarRepositories.xml
9+
.idea/compiler.xml
10+
.idea/libraries/
11+
*.iws
12+
*.iml
13+
*.ipr
14+
15+
### Eclipse ###
16+
.apt_generated
17+
.classpath
18+
.factorypath
19+
.project
20+
.settings
21+
.springBeans
22+
.sts4-cache
23+
24+
### NetBeans ###
25+
/nbproject/private/
26+
/nbbuild/
27+
/dist/
28+
/nbdist/
29+
/.nb-gradle/
30+
build/
31+
!**/src/main/**/build/
32+
!**/src/test/**/build/
33+
34+
### VS Code ###
35+
.vscode/
36+
37+
### Mac OS ###
38+
.DS_Store
Collapse file
+27Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>org.example</groupId>
5+
<artifactId>JacksonBasic</artifactId>
6+
<version>1.0-SNAPSHOT</version>
7+
<name>Archetype - JacksonBasic</name>
8+
<url>http://maven.apache.org</url>
9+
<dependencies>
10+
<dependency>
11+
<groupId>com.fasterxml.jackson.core</groupId>
12+
<artifactId>jackson-databind</artifactId>
13+
<version>2.7.9</version>
14+
</dependency>
15+
<dependency>
16+
<groupId>com.fasterxml.jackson.core</groupId>
17+
<artifactId>jackson-core</artifactId>
18+
<version>2.7.9</version>
19+
</dependency>
20+
<dependency>
21+
<groupId>com.fasterxml.jackson.core</groupId>
22+
<artifactId>jackson-annotations</artifactId>
23+
<version>2.7.9</version>
24+
</dependency>
25+
26+
</dependencies>
27+
</project>
Collapse file
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.drunkbaby;
2+
3+
import com.fasterxml.jackson.databind.ObjectMapper;
4+
5+
public class JacksonTest {
6+
public static void main(String[] args) throws Exception {
7+
Person p = new Person();
8+
p.age = 6;
9+
p.name = "Drunkbaby";
10+
ObjectMapper mapper = new ObjectMapper();
11+
12+
String json = mapper.writeValueAsString(p);
13+
System.out.println(json);
14+
15+
Person p2 = mapper.readValue(json, Person.class);
16+
System.out.println(p2);
17+
}
18+
}
Collapse file
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.drunkbaby;
2+
3+
public class Person {
4+
public int age;
5+
public String name;
6+
7+
@Override
8+
public String toString() {
9+
return String.format("com.drunkbaby.Person.age=%d, com.drunkbaby.Person.name=%s", age, name);
10+
}
11+
}
Collapse file
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<archetype>
2+
<id>JacksonBasic</id>
3+
<sources>
4+
<source>src/main/java/App.java</source>
5+
</sources>
6+
<testSources>
7+
<source>src/test/java/AppTest.java</source>
8+
</testSources>
9+
</archetype>
Collapse file
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>$org.example</groupId>
5+
<artifactId>$JacksonBasic</artifactId>
6+
<version>$1.0-SNAPSHOT</version>
7+
<dependencies>
8+
<dependency>
9+
<groupId>junit</groupId>
10+
<artifactId>junit</artifactId>
11+
<version>3.8.1</version>
12+
<scope>test</scope>
13+
</dependency>
14+
</dependencies>
15+
</project>
Collapse file
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package $org.example;
2+
3+
/**
4+
* Hello world!
5+
*
6+
*/
7+
public class App
8+
{
9+
public static void main( String[] args )
10+
{
11+
System.out.println( "Hello World!" );
12+
}
13+
}
Collapse file
+38Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package $org.example;
2+
3+
import junit.framework.Test;
4+
import junit.framework.TestCase;
5+
import junit.framework.TestSuite;
6+
7+
/**
8+
* Unit test for simple App.
9+
*/
10+
public class AppTest
11+
extends TestCase
12+
{
13+
/**
14+
* Create the test case
15+
*
16+
* @param testName name of the test case
17+
*/
18+
public AppTest( String testName )
19+
{
20+
super( testName );
21+
}
22+
23+
/**
24+
* @return the suite of tests being tested
25+
*/
26+
public static Test suite()
27+
{
28+
return new TestSuite( AppTest.class );
29+
}
30+
31+
/**
32+
* Rigourous Test :-)
33+
*/
34+
public void testApp()
35+
{
36+
assertTrue( true );
37+
}
38+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.