[BAEL-13511] - Create jackson-modules parent for all related modules
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package com.baeldung.exceptions;
|
||||
|
||||
public class User {
|
||||
public int id;
|
||||
public String name;
|
||||
|
||||
public User() {
|
||||
super();
|
||||
}
|
||||
|
||||
public User(final int id, final String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
// API
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.baeldung.exceptions;
|
||||
|
||||
public class UserWithConflict {
|
||||
public int id;
|
||||
public String name;
|
||||
boolean checked;
|
||||
|
||||
public UserWithConflict() {
|
||||
super();
|
||||
}
|
||||
|
||||
public UserWithConflict(final int id, final String name, final boolean checked) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.checked = checked;
|
||||
}
|
||||
|
||||
public boolean getChecked() {
|
||||
return checked;
|
||||
}
|
||||
|
||||
public boolean isChecked() {
|
||||
return checked;
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.baeldung.exceptions;
|
||||
|
||||
public class UserWithNoDefaultConstructor {
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
|
||||
public UserWithNoDefaultConstructor(final int id, final String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.baeldung.exceptions;
|
||||
|
||||
public class UserWithPrivateFields {
|
||||
int id;
|
||||
String name;
|
||||
|
||||
public UserWithPrivateFields() {
|
||||
super();
|
||||
}
|
||||
|
||||
public UserWithPrivateFields(final int id, final String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.baeldung.exceptions;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||
|
||||
@JsonRootName(value = "user")
|
||||
public class UserWithRoot {
|
||||
public int id;
|
||||
public String name;
|
||||
|
||||
public UserWithRoot() {
|
||||
super();
|
||||
}
|
||||
|
||||
public UserWithRoot(final int id, final String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.baeldung.exceptions;
|
||||
|
||||
public class Zoo {
|
||||
public Animal animal;
|
||||
|
||||
public Zoo() {
|
||||
}
|
||||
}
|
||||
|
||||
abstract class Animal {
|
||||
public String name;
|
||||
|
||||
public Animal() {
|
||||
}
|
||||
}
|
||||
|
||||
class Cat extends Animal {
|
||||
public int lives;
|
||||
|
||||
public Cat() {
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.baeldung.exceptions;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
public class ZooConfigured {
|
||||
public AnimalConfigured animal;
|
||||
|
||||
public ZooConfigured() {
|
||||
}
|
||||
}
|
||||
|
||||
@JsonDeserialize(as = CatConfigured.class)
|
||||
abstract class AnimalConfigured {
|
||||
public String name;
|
||||
|
||||
public AnimalConfigured() {
|
||||
}
|
||||
}
|
||||
|
||||
class CatConfigured extends AnimalConfigured {
|
||||
public int lives;
|
||||
|
||||
public CatConfigured() {
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.baeldung.mappingexception;
|
||||
|
||||
public class MyDtoNoAccessors {
|
||||
|
||||
String stringValue;
|
||||
int intValue;
|
||||
boolean booleanValue;
|
||||
|
||||
public MyDtoNoAccessors() {
|
||||
super();
|
||||
}
|
||||
|
||||
public MyDtoNoAccessors(final String stringValue, final int intValue, final boolean booleanValue) {
|
||||
super();
|
||||
|
||||
this.stringValue = stringValue;
|
||||
this.intValue = intValue;
|
||||
this.booleanValue = booleanValue;
|
||||
}
|
||||
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.baeldung.mappingexception;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
|
||||
|
||||
@JsonAutoDetect(fieldVisibility = Visibility.ANY)
|
||||
public class MyDtoNoAccessorsAndFieldVisibility {
|
||||
|
||||
String stringValue;
|
||||
int intValue;
|
||||
boolean booleanValue;
|
||||
|
||||
public MyDtoNoAccessorsAndFieldVisibility() {
|
||||
super();
|
||||
}
|
||||
|
||||
public MyDtoNoAccessorsAndFieldVisibility(final String stringValue, final int intValue, final boolean booleanValue) {
|
||||
super();
|
||||
|
||||
this.stringValue = stringValue;
|
||||
this.intValue = intValue;
|
||||
this.booleanValue = booleanValue;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user