Unify jackson package structure
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.baeldung.jacksonannotation.deserialization.jacksoninject;
|
||||
package com.baeldung.jackson.deserialization.jacksoninject;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Item;
|
||||
import com.baeldung.jackson.domain.Item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.deserialization.jacksoninject;
|
||||
package com.baeldung.jackson.deserialization.jacksoninject;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JacksonInject;
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.baeldung.jacksonannotation.deserialization.jsonanysetter;
|
||||
package com.baeldung.jackson.deserialization.jsonanysetter;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Author;
|
||||
import com.baeldung.jacksonannotation.domain.Item;
|
||||
import com.baeldung.jackson.domain.Author;
|
||||
import com.baeldung.jackson.domain.Item;
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package com.baeldung.jacksonannotation.deserialization.jsoncreator;
|
||||
package com.baeldung.jackson.deserialization.jsoncreator;
|
||||
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Item;
|
||||
import com.baeldung.jacksonannotation.domain.Person;
|
||||
import com.baeldung.jackson.domain.Person;
|
||||
import com.baeldung.jackson.domain.Item;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.baeldung.jacksonannotation.deserialization.jsondeserialize;
|
||||
package com.baeldung.jackson.deserialization.jsondeserialize;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Item;
|
||||
import com.baeldung.jacksonannotation.domain.Person;
|
||||
import com.baeldung.jackson.domain.Item;
|
||||
import com.baeldung.jackson.domain.Person;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.deserialization.jsondeserialize;
|
||||
package com.baeldung.jackson.deserialization.jsondeserialize;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.deserialization.jsondeserialize;
|
||||
package com.baeldung.jackson.deserialization.jsondeserialize;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.baeldung.jacksonannotation.general.jsonproperty;
|
||||
package com.baeldung.jackson.deserialization.jsondeserialize;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Person;
|
||||
import com.baeldung.jackson.domain.Person;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.baeldung.jacksonannotation.deserialization.jsonsetter;
|
||||
package com.baeldung.jackson.deserialization.jsonsetter;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Item;
|
||||
import com.baeldung.jacksonannotation.domain.Person;
|
||||
import com.baeldung.jackson.domain.Item;
|
||||
import com.baeldung.jackson.domain.Person;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonSetter;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.domain;
|
||||
package com.baeldung.jackson.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.domain;
|
||||
package com.baeldung.jackson.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.domain;
|
||||
package com.baeldung.jackson.domain;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.domain;
|
||||
package com.baeldung.jackson.domain;
|
||||
|
||||
/**
|
||||
* Source code github.com/readlearncode
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.domain;
|
||||
package com.baeldung.jackson.domain;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.domain;
|
||||
package com.baeldung.jackson.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.domain;
|
||||
package com.baeldung.jackson.domain;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.domain;
|
||||
package com.baeldung.jackson.domain;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.jackson.entities;
|
||||
package com.baeldung.jackson.entities;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.jackson.entities;
|
||||
package com.baeldung.jackson.entities;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.baeldung.jackson.entities;
|
||||
package com.baeldung.jackson.entities;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package com.baeldung.jacksonannotation.format;
|
||||
package com.baeldung.jackson.format;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Person;
|
||||
import com.baeldung.jackson.domain.Person;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* @author Jay Sridhar
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.inclusion.jsonautodetect;
|
||||
package com.baeldung.jackson.inclusion.jsonautodetect;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.baeldung.jacksonannotation.inclusion.jsonignore;
|
||||
package com.baeldung.jackson.inclusion.jsonignore;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Item;
|
||||
import com.baeldung.jackson.domain.Item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.inclusion.jsonignore;
|
||||
package com.baeldung.jackson.inclusion.jsonignore;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.baeldung.jacksonannotation.inclusion.jsonignoreproperties;
|
||||
package com.baeldung.jackson.inclusion.jsonignoreproperties;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Author;
|
||||
import com.baeldung.jacksonannotation.domain.Item;
|
||||
import com.baeldung.jackson.domain.Author;
|
||||
import com.baeldung.jackson.domain.Item;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import java.util.List;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.inclusion.jsonignoretype;
|
||||
package com.baeldung.jackson.inclusion.jsonignoretype;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreType;
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.baeldung.jacksonannotation.inclusion.jsoninclude;
|
||||
package com.baeldung.jackson.inclusion.jsoninclude;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Item;
|
||||
import com.baeldung.jacksonannotation.domain.Person;
|
||||
import com.baeldung.jackson.domain.Person;
|
||||
import com.baeldung.jackson.domain.Item;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
import java.util.ArrayList;
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.baeldung.jacksonannotation.miscellaneous.custom;
|
||||
package com.baeldung.jackson.miscellaneous.custom;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Author;
|
||||
import com.baeldung.jackson.domain.Author;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.miscellaneous.custom;
|
||||
package com.baeldung.jackson.miscellaneous.custom;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
package com.baeldung.jacksonannotation.deserialization.jsondeserialize;
|
||||
package com.baeldung.jackson.miscellaneous.custom;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Person;
|
||||
import com.baeldung.jackson.domain.Author;
|
||||
import com.baeldung.jackson.domain.Person;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.baeldung.jacksonannotation.miscellaneous.disable;
|
||||
package com.baeldung.jackson.miscellaneous.disable;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Item;
|
||||
import com.baeldung.jacksonannotation.domain.Person;
|
||||
import com.baeldung.jackson.domain.Item;
|
||||
import com.baeldung.jackson.domain.Person;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
package com.baeldung.jacksonannotation.general.jsonproperty;
|
||||
package com.baeldung.jackson.miscellaneous.mixin;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Person;
|
||||
import com.baeldung.jackson.domain.Item;
|
||||
import com.baeldung.jackson.domain.Person;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.miscellaneous.mixin;
|
||||
package com.baeldung.jackson.miscellaneous.mixin;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreType;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.polymorphism;
|
||||
package com.baeldung.jackson.polymorphism;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
package org.baeldung.jackson.serialization;
|
||||
package com.baeldung.jackson.serialization;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.baeldung.jackson.entities.ActorJackson;
|
||||
import com.baeldung.jackson.entities.ActorJackson;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.baeldung.jacksonannotation.serialization.jsonanygetter;
|
||||
package com.baeldung.jackson.serialization.jsonanygetter;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Author;
|
||||
import com.baeldung.jacksonannotation.domain.Item;
|
||||
import com.baeldung.jackson.domain.Author;
|
||||
import com.baeldung.jackson.domain.Item;
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package com.baeldung.jacksonannotation.serialization.jsongetter;
|
||||
package com.baeldung.jackson.serialization.jsongetter;
|
||||
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Item;
|
||||
import com.baeldung.jacksonannotation.domain.Person;
|
||||
import com.baeldung.jackson.domain.Item;
|
||||
import com.baeldung.jackson.domain.Person;
|
||||
import com.fasterxml.jackson.annotation.JsonGetter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package com.baeldung.jacksonannotation.serialization.jsonpropertyorder;
|
||||
package com.baeldung.jackson.serialization.jsonpropertyorder;
|
||||
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Item;
|
||||
import com.baeldung.jackson.domain.Item;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.serialization.jsonpropertyorder;
|
||||
package com.baeldung.jackson.serialization.jsonpropertyorder;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.baeldung.jacksonannotation.serialization.jsonrawvalue;
|
||||
package com.baeldung.jackson.serialization.jsonrawvalue;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Person;
|
||||
import com.baeldung.jackson.domain.Person;
|
||||
import com.fasterxml.jackson.annotation.JsonRawValue;
|
||||
|
||||
/**
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.baeldung.jacksonannotation.serialization.jsonrootname;
|
||||
package com.baeldung.jackson.serialization.jsonrootname;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Item;
|
||||
import com.baeldung.jacksonannotation.domain.Person;
|
||||
import com.baeldung.jackson.domain.Item;
|
||||
import com.baeldung.jackson.domain.Person;
|
||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
+5
-6
@@ -1,6 +1,6 @@
|
||||
package com.baeldung.jacksonannotation.general.reference;
|
||||
package com.baeldung.jackson.serialization.jsonserialize;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||
import com.baeldung.jackson.domain.Person;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -13,18 +13,17 @@ import java.util.List;
|
||||
*/
|
||||
public class Author extends Person {
|
||||
|
||||
private List<Item> items = new ArrayList<>();
|
||||
List<com.baeldung.jackson.domain.Item> items = new ArrayList<>();
|
||||
|
||||
public Author(String firstName, String lastName) {
|
||||
super(firstName, lastName);
|
||||
}
|
||||
|
||||
@JsonManagedReference
|
||||
public List<Item> getItems() {
|
||||
public List<com.baeldung.jackson.domain.Item> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<Item> items) {
|
||||
public void setItems(List<com.baeldung.jackson.domain.Item> items) {
|
||||
this.items = items;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.serialization.jsonserialize;
|
||||
package com.baeldung.jackson.serialization.jsonserialize;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.jacksonannotation.serialization.jsonserialize;
|
||||
package com.baeldung.jackson.serialization.jsonserialize;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.baeldung.jacksonannotation.serialization.jsonserialize;
|
||||
package com.baeldung.jackson.serialization.jsonserialize;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Person;
|
||||
import com.baeldung.jackson.domain.Person;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.baeldung.jacksonannotation.serialization.jsonvalue;
|
||||
package com.baeldung.jackson.serialization.jsonvalue;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Author;
|
||||
import com.baeldung.jacksonannotation.domain.Item;
|
||||
import com.baeldung.jackson.domain.Author;
|
||||
import com.baeldung.jackson.domain.Item;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
import java.util.List;
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.baeldung.jacksonannotation.general.jsonfilter;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Item;
|
||||
import com.baeldung.jacksonannotation.domain.Person;
|
||||
import com.fasterxml.jackson.annotation.JsonFilter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Source code github.com/readlearncode
|
||||
*
|
||||
* @author Alex Theedom www.readlearncode.com
|
||||
* @version 1.0
|
||||
*/
|
||||
@JsonFilter("authorFilter")
|
||||
public class Author extends Person {
|
||||
|
||||
private List<Item> items = new ArrayList<>();
|
||||
|
||||
public Author(String firstName, String lastName) {
|
||||
super(firstName, lastName);
|
||||
}
|
||||
|
||||
public List<Item> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<Item> items) {
|
||||
this.items = items;
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package com.baeldung.jacksonannotation.general.jsonformat;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Author;
|
||||
import com.baeldung.jacksonannotation.domain.Item;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Source code github.com/readlearncode
|
||||
*
|
||||
* @author Alex Theedom www.readlearncode.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Book extends Item {
|
||||
|
||||
private String ISBN;
|
||||
|
||||
@JsonFormat(
|
||||
shape = JsonFormat.Shape.STRING,
|
||||
pattern = "dd-MM-yyyy HH:mm:ss")
|
||||
private Date published;
|
||||
private BigDecimal pages;
|
||||
|
||||
public Book() {
|
||||
}
|
||||
|
||||
public Book(String title, Author author) {
|
||||
super(title, author);
|
||||
}
|
||||
|
||||
public String getISBN() {
|
||||
return ISBN;
|
||||
}
|
||||
|
||||
public void setISBN(String ISBN) {
|
||||
this.ISBN = ISBN;
|
||||
}
|
||||
|
||||
public Date getPublished() {
|
||||
return published;
|
||||
}
|
||||
|
||||
public void setPublished(Date published) {
|
||||
this.published = published;
|
||||
}
|
||||
|
||||
public BigDecimal getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
public void setPages(BigDecimal pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
package com.baeldung.jacksonannotation.general.jsonidentityinfo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Source code github.com/readlearncode
|
||||
*
|
||||
* @author Alex Theedom www.readlearncode.com
|
||||
* @version 1.0
|
||||
*/
|
||||
@JsonIdentityInfo(
|
||||
generator = ObjectIdGenerators.PropertyGenerator.class,
|
||||
property = "id")
|
||||
public class Author extends Person {
|
||||
|
||||
private List<Item> items = new ArrayList<>();
|
||||
|
||||
public Author(String firstName, String lastName) {
|
||||
super(firstName, lastName);
|
||||
}
|
||||
|
||||
public List<Item> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<Item> items) {
|
||||
this.items = items;
|
||||
}
|
||||
}
|
||||
-72
@@ -1,72 +0,0 @@
|
||||
package com.baeldung.jacksonannotation.general.jsonidentityinfo;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Source code github.com/readlearncode
|
||||
*
|
||||
* @author Alex Theedom www.readlearncode.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Course extends Item {
|
||||
|
||||
public enum Medium {CLASSROOM, ONLINE}
|
||||
|
||||
public enum Level {
|
||||
BEGINNER("Beginner", 1), INTERMEDIATE("Intermediate", 2), ADVANCED("Advanced", 3);
|
||||
|
||||
private String name;
|
||||
private int number;
|
||||
|
||||
Level(String name, int number) {
|
||||
this.name = name;
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
private float duration;
|
||||
private Medium medium;
|
||||
private Level level;
|
||||
private List<Course> prerequisite;
|
||||
|
||||
public Course(String title, Author author) {
|
||||
super(title, author);
|
||||
}
|
||||
|
||||
public float getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(float duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public Medium getMedium() {
|
||||
return medium;
|
||||
}
|
||||
|
||||
public void setMedium(Medium medium) {
|
||||
this.medium = medium;
|
||||
}
|
||||
|
||||
public Level getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(Level level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public List<Course> getPrerequisite() {
|
||||
return prerequisite;
|
||||
}
|
||||
|
||||
public void setPrerequisite(List<Course> prerequisite) {
|
||||
this.prerequisite = prerequisite;
|
||||
}
|
||||
}
|
||||
-65
@@ -1,65 +0,0 @@
|
||||
package com.baeldung.jacksonannotation.general.jsonidentityinfo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Source code github.com/readlearncode
|
||||
*
|
||||
* @author Alex Theedom www.readlearncode.com
|
||||
* @version 1.0
|
||||
*/
|
||||
@JsonIdentityInfo(
|
||||
generator = ObjectIdGenerators.PropertyGenerator.class,
|
||||
property = "id")
|
||||
public class Item {
|
||||
|
||||
private UUID id;
|
||||
private String title;
|
||||
private List<Person> authors = new ArrayList<>();
|
||||
private float price;
|
||||
|
||||
public Item(){}
|
||||
|
||||
public Item(String title, Author author) {
|
||||
this.id = UUID.randomUUID();
|
||||
this.title = title;
|
||||
this.authors.add(author);
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public List<Person> getAuthors() {
|
||||
return authors;
|
||||
}
|
||||
|
||||
public void setAuthors(List<Person> authors) {
|
||||
this.authors = authors;
|
||||
}
|
||||
|
||||
public float getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(float price) {
|
||||
this.price = price;
|
||||
}
|
||||
}
|
||||
-44
@@ -1,44 +0,0 @@
|
||||
package com.baeldung.jacksonannotation.general.jsonidentityinfo;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Source code github.com/readlearncode
|
||||
*
|
||||
* @author Alex Theedom www.readlearncode.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Person {
|
||||
|
||||
private UUID id;
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
|
||||
public Person(){}
|
||||
|
||||
public Person(String firstName, String lastName) {
|
||||
this.id = UUID.randomUUID();
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package com.baeldung.jacksonannotation.general.jsonproperty;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Source code github.com/readlearncode
|
||||
*
|
||||
* @author Alex Theedom www.readlearncode.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Book extends Item {
|
||||
|
||||
private String ISBN;
|
||||
private Date published;
|
||||
private BigDecimal pages;
|
||||
private String binding;
|
||||
|
||||
public Book() {
|
||||
}
|
||||
|
||||
public Book(String title, Author author) {
|
||||
super(title, author);
|
||||
}
|
||||
|
||||
public String getISBN() {
|
||||
return ISBN;
|
||||
}
|
||||
|
||||
public void setISBN(String ISBN) {
|
||||
this.ISBN = ISBN;
|
||||
}
|
||||
|
||||
public Date getPublished() {
|
||||
return published;
|
||||
}
|
||||
|
||||
public void setPublished(Date published) {
|
||||
this.published = published;
|
||||
}
|
||||
|
||||
public BigDecimal getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
public void setPages(BigDecimal pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
|
||||
@JsonProperty("binding")
|
||||
public String coverBinding() {
|
||||
return binding;
|
||||
}
|
||||
|
||||
@JsonProperty("binding")
|
||||
public void configureBinding(String binding) {
|
||||
this.binding = binding;
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.baeldung.jacksonannotation.general.jsonunwrapped;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonUnwrapped;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Source code github.com/readlearncode
|
||||
*
|
||||
* @author Alex Theedom www.readlearncode.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Order {
|
||||
|
||||
private UUID id;
|
||||
|
||||
@JsonUnwrapped
|
||||
private Type type;
|
||||
private int internalAudit;
|
||||
|
||||
public static class Type {
|
||||
public long id;
|
||||
public String name;
|
||||
}
|
||||
|
||||
public Order() {
|
||||
this.id = UUID.randomUUID();
|
||||
}
|
||||
|
||||
public Order(Type type) {
|
||||
this();
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Order(int internalAudit) {
|
||||
this();
|
||||
this.type = new Type();
|
||||
this.type.id = 20;
|
||||
this.type.name = "Order";
|
||||
this.internalAudit = internalAudit;
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package com.baeldung.jacksonannotation.general.jsonview;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Source code github.com/readlearncode
|
||||
*
|
||||
* @author Alex Theedom www.readlearncode.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Order {
|
||||
|
||||
@JsonView(Views.Public.class)
|
||||
private UUID id;
|
||||
|
||||
@JsonView(Views.Public.class)
|
||||
private Type type;
|
||||
|
||||
@JsonView(Views.Internal.class)
|
||||
private int internalAudit;
|
||||
|
||||
public static class Type {
|
||||
public long id;
|
||||
public String name;
|
||||
}
|
||||
|
||||
public Order() {
|
||||
this.id = UUID.randomUUID();
|
||||
}
|
||||
|
||||
public Order(Type type) {
|
||||
this();
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Order(int internalAudit) {
|
||||
this();
|
||||
this.type = new Type();
|
||||
this.type.id = 20;
|
||||
this.type.name = "Order";
|
||||
this.internalAudit = internalAudit;
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.baeldung.jacksonannotation.general.jsonview;
|
||||
|
||||
/**
|
||||
* Source code github.com/readlearncode
|
||||
*
|
||||
* @author Alex Theedom www.readlearncode.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Views {
|
||||
public static class Public {
|
||||
}
|
||||
|
||||
public static class Internal extends Public {
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.baeldung.jacksonannotation.general.reference;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Source code github.com/readlearncode
|
||||
*
|
||||
* @author Alex Theedom www.readlearncode.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Course extends Item {
|
||||
|
||||
public enum Medium {CLASSROOM, ONLINE}
|
||||
|
||||
public enum Level {
|
||||
BEGINNER("Beginner", 1), INTERMEDIATE("Intermediate", 2), ADVANCED("Advanced", 3);
|
||||
|
||||
private String name;
|
||||
private int number;
|
||||
|
||||
Level(String name, int number) {
|
||||
this.name = name;
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
private float duration;
|
||||
private Medium medium;
|
||||
private Level level;
|
||||
private List<Course> prerequisite;
|
||||
|
||||
public Course(String title, Author author) {
|
||||
super(title, author);
|
||||
}
|
||||
|
||||
public float getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(float duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public Medium getMedium() {
|
||||
return medium;
|
||||
}
|
||||
|
||||
public void setMedium(Medium medium) {
|
||||
this.medium = medium;
|
||||
}
|
||||
|
||||
public Level getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(Level level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public List<Course> getPrerequisite() {
|
||||
return prerequisite;
|
||||
}
|
||||
|
||||
public void setPrerequisite(List<Course> prerequisite) {
|
||||
this.prerequisite = prerequisite;
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package com.baeldung.jacksonannotation.general.reference;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Source code github.com/readlearncode
|
||||
*
|
||||
* @author Alex Theedom www.readlearncode.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Item {
|
||||
|
||||
private UUID id;
|
||||
private String title;
|
||||
|
||||
@JsonBackReference
|
||||
private List<Person> authors = new ArrayList<>();
|
||||
private float price;
|
||||
|
||||
public Item(){}
|
||||
|
||||
public Item(String title, Author author) {
|
||||
this.id = UUID.randomUUID();
|
||||
this.title = title;
|
||||
this.authors.add(author);
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public List<Person> getAuthors() {
|
||||
return authors;
|
||||
}
|
||||
|
||||
public void setAuthors(List<Person> authors) {
|
||||
this.authors = authors;
|
||||
}
|
||||
|
||||
public float getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(float price) {
|
||||
this.price = price;
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.baeldung.jacksonannotation.general.reference;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Source code github.com/readlearncode
|
||||
*
|
||||
* @author Alex Theedom www.readlearncode.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Person {
|
||||
|
||||
private UUID id;
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
|
||||
public Person(){}
|
||||
|
||||
public Person(String firstName, String lastName) {
|
||||
this.id = UUID.randomUUID();
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package com.baeldung.jacksonannotation.miscellaneous.custom;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Author;
|
||||
import com.baeldung.jacksonannotation.domain.Person;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Source code github.com/readlearncode
|
||||
*
|
||||
* @author Alex Theedom www.readlearncode.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Item {
|
||||
|
||||
private UUID id;
|
||||
private String title;
|
||||
private List<Person> authors = new ArrayList<>();
|
||||
private float price;
|
||||
|
||||
public Item(){}
|
||||
|
||||
public Item(String title, Author author) {
|
||||
this.id = UUID.randomUUID();
|
||||
this.title = title;
|
||||
this.authors.add(author);
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public List<Person> getAuthors() {
|
||||
return authors;
|
||||
}
|
||||
|
||||
public void setAuthors(List<Person> authors) {
|
||||
this.authors = authors;
|
||||
}
|
||||
|
||||
public float getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(float price) {
|
||||
this.price = price;
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.baeldung.jacksonannotation.miscellaneous.mixin;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Item;
|
||||
import com.baeldung.jacksonannotation.domain.Person;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Source code github.com/readlearncode
|
||||
*
|
||||
* @author Alex Theedom www.readlearncode.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Author extends Person {
|
||||
|
||||
private List<Item> items = new ArrayList<>();
|
||||
|
||||
public Author(String firstName, String lastName) {
|
||||
super(firstName, lastName);
|
||||
}
|
||||
|
||||
public List<Item> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<Item> items) {
|
||||
this.items = items;
|
||||
}
|
||||
}
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
package com.baeldung.jacksonannotation.serialization.jsonserialize;
|
||||
|
||||
import com.baeldung.jacksonannotation.domain.Item;
|
||||
import com.baeldung.jacksonannotation.domain.Person;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Source code github.com/readlearncode
|
||||
*
|
||||
* @author Alex Theedom www.readlearncode.com
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Author extends Person {
|
||||
|
||||
List<Item> items = new ArrayList<>();
|
||||
|
||||
public Author(String firstName, String lastName) {
|
||||
super(firstName, lastName);
|
||||
}
|
||||
|
||||
public List<Item> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<Item> items) {
|
||||
this.items = items;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user