Merge pull request #7174 from amit2103/BAEL-14274-8
[BAEL-14274] - Fixed article code for https://www.baeldung.com/jackso…
This commit is contained in:
commit
817e6e69fd
|
@ -1,8 +1,10 @@
|
|||
package com.baeldung.jackson.annotation;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonSetter;
|
||||
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
@JsonPropertyOrder({ "name", "id" })
|
||||
|
@ -18,4 +20,14 @@ public class MyBean {
|
|||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@JsonGetter("name")
|
||||
public String getTheName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@JsonSetter("name")
|
||||
public void setTheName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue