jackson cleanup work
This commit is contained in:
parent
9d1002385c
commit
31fd5453a5
|
@ -4,6 +4,7 @@ import java.io.IOException;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
@ -16,6 +17,8 @@ public class SandboxTest {
|
|||
testElement.setX(10);
|
||||
testElement.setY("adasd");
|
||||
final ObjectMapper om = new ObjectMapper();
|
||||
om.setVisibilityChecker(om.getSerializationConfig().getDefaultVisibilityChecker().withFieldVisibility(JsonAutoDetect.Visibility.ANY).withGetterVisibility(JsonAutoDetect.Visibility.NONE));
|
||||
|
||||
final String serialized = om.writeValueAsString(testElement);
|
||||
System.err.println(serialized);
|
||||
}
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
package org.baeldung.jackson.sandbox;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
public class TestElement {
|
||||
|
||||
int x;
|
||||
|
||||
@JsonIgnore
|
||||
private String y;
|
||||
private transient String y;
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
|
|
Loading…
Reference in New Issue