Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Commit

Permalink
Merge pull request #64 from lucaspouzac/master
Browse files Browse the repository at this point in the history
Fix #63: Revert back expansion of NON_EMPTY handling (Jackson 2.7.x)
  • Loading branch information
cowtowncoder committed Jan 17, 2016
2 parents 662e907 + 4cbd8c0 commit 0f168c8
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ public BooleanFieldPropertyWriter(BeanPropertyWriter src, BeanPropertyAccessor a
JsonSerializer<Object> ser) {
super(src, acc, index, ser);

if (MARKER_FOR_EMPTY == _suppressableValue) {
_suppressableBoolean = false;
_suppressableSet = true;
} else if (_suppressableValue instanceof Boolean) {
if (_suppressableValue instanceof Boolean) {
_suppressableBoolean = ((Boolean)_suppressableValue).booleanValue();
_suppressableSet = true;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ public BooleanMethodPropertyWriter(BeanPropertyWriter src, BeanPropertyAccessor
JsonSerializer<Object> ser) {
super(src, acc, index, ser);

if (MARKER_FOR_EMPTY == _suppressableValue) {
_suppressableBoolean = false;
_suppressableSet = true;
} else if (_suppressableValue instanceof Boolean) {
if (_suppressableValue instanceof Boolean) {
_suppressableBoolean = ((Boolean)_suppressableValue).booleanValue();
_suppressableSet = true;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ public IntFieldPropertyWriter(BeanPropertyWriter src, BeanPropertyAccessor acc,
JsonSerializer<Object> ser) {
super(src, acc, index, ser);

if (MARKER_FOR_EMPTY == _suppressableValue) {
_suppressableInt = 0;
_suppressableIntSet = true;
} else if (_suppressableValue instanceof Integer) {
if (_suppressableValue instanceof Integer) {
_suppressableInt = ((Integer)_suppressableValue).intValue();
_suppressableIntSet = true;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ public IntMethodPropertyWriter(BeanPropertyWriter src, BeanPropertyAccessor acc,
JsonSerializer<Object> ser) {
super(src, acc, index, ser);

if (MARKER_FOR_EMPTY == _suppressableValue) {
_suppressableInt = 0;
_suppressableIntSet = true;
} else if (_suppressableValue instanceof Integer) {
if (_suppressableValue instanceof Integer) {
_suppressableInt = (Integer)_suppressableValue;
_suppressableIntSet = true;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ public LongFieldPropertyWriter(BeanPropertyWriter src, BeanPropertyAccessor acc,
JsonSerializer<Object> ser) {
super(src, acc, index, ser);

if (MARKER_FOR_EMPTY == _suppressableValue) {
_suppressableLong = 0L;
_suppressableLongSet = true;
} else if (_suppressableValue instanceof Long) {
if (_suppressableValue instanceof Long) {
_suppressableLong = (Long)_suppressableValue;
_suppressableLongSet = true;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ public LongMethodPropertyWriter(BeanPropertyWriter src, BeanPropertyAccessor acc
JsonSerializer<Object> ser) {
super(src, acc, index, ser);

if (MARKER_FOR_EMPTY == _suppressableValue) {
_suppressableLong = 0L;
_suppressableLongSet = true;
} else if (_suppressableValue instanceof Long) {
if (_suppressableValue instanceof Long) {
_suppressableLong = (Long)_suppressableValue;
_suppressableLongSet = true;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,7 @@ public void testEmptyExclusion() throws Exception
{
ObjectMapper mapper = mapperWithModule();
String json;

json = mapper.writeValueAsString(new NonEmptyIntWrapper(3));
assertEquals("{\"value\":3}", json);
json = mapper.writeValueAsString(new NonEmptyIntWrapper(0));
assertEquals("{}", json);


json = mapper.writeValueAsString(new NonEmptyStringWrapper("x"));
assertEquals("{\"value\":\"x\"}", json);
json = mapper.writeValueAsString(new NonEmptyStringWrapper(""));
Expand All @@ -95,11 +90,6 @@ public void testEmptyExclusionViaClass() throws Exception
{
ObjectMapper mapper = mapperWithModule();

assertEquals("{\"value\":3}",
mapper.writeValueAsString(new NonEmptyIntWrapper2(3)));
assertEquals("{}",
mapper.writeValueAsString(new NonEmptyIntWrapper2(0)));

assertEquals("{\"value\":\"x\"}",
mapper.writeValueAsString(new NonEmptyStringWrapper2("x")));
assertEquals("{}",
Expand Down

0 comments on commit 0f168c8

Please sign in to comment.