jackson cleanup work

This commit is contained in:
eugenp 2014-02-13 23:05:21 +02:00
parent 9d1002385c
commit 31fd5453a5
2 changed files with 4 additions and 4 deletions

View File

@ -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);
}

View File

@ -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;