-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding support for @JsonBackreference (#24)
- Loading branch information
1 parent
0a13818
commit a1d3ae9
Showing
3 changed files
with
90 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
json-view/src/test/java/com/monitorjbl/json/model/TestBackreferenceObject.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.monitorjbl.json.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonBackReference; | ||
import com.fasterxml.jackson.annotation.JsonManagedReference; | ||
|
||
import java.util.List; | ||
|
||
public class TestBackreferenceObject { | ||
|
||
private String id; | ||
@JsonBackReference | ||
private List<TestForwardReferenceObject> children; | ||
|
||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public List<TestForwardReferenceObject> getChildren() { | ||
return children; | ||
} | ||
|
||
public void setChildren(List<TestForwardReferenceObject> children) { | ||
this.children = children; | ||
} | ||
|
||
public static class TestForwardReferenceObject{ | ||
private String id; | ||
@JsonManagedReference | ||
private TestBackreferenceObject parent; | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public TestBackreferenceObject getParent() { | ||
return parent; | ||
} | ||
|
||
public void setParent(TestBackreferenceObject parent) { | ||
this.parent = parent; | ||
} | ||
} | ||
} |