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

fix for issue #48 #49

Merged
merged 1 commit into from
Jan 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ protected OptimizedBeanPropertyWriter(BeanPropertyWriter src,
{
super(src);
this.fallbackWriter = unwrapFallbackWriter(src);
_serializer = ser; // from base class
// either use the passed on serializer or the original one
_serializer = (ser != null) ? ser : src.getSerializer();
_propertyAccessor = propertyAccessor;
_propertyIndex = propertyIndex;
_fastName = src.getSerializedName();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.fasterxml.jackson.module.afterburner.bug48;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.module.afterburner.AfterburnerModule;
import com.fasterxml.jackson.module.afterburner.AfterburnerTestBase;

import java.math.BigDecimal;

/**
* @author Joost van de Wijgerd
*/
public class TestJsonSerializeAnnotationBug extends AfterburnerTestBase {
public void testAfterburnerModule() throws JsonProcessingException {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new AfterburnerModule());

String value = objectMapper.writeValueAsString(new TestObjectWithJsonSerialize(new BigDecimal("870.04")));


}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.fasterxml.jackson.module.afterburner.bug48;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;

import java.math.BigDecimal;

/**
* @author Joost van de Wijgerd
*/
public final class TestObjectWithJsonSerialize {
@JsonSerialize(using = ToStringSerializer.class)
private final BigDecimal amount;

@JsonCreator
public TestObjectWithJsonSerialize(@JsonProperty("amount") BigDecimal amount) {
this.amount = amount;
}

@JsonSerialize(using = ToStringSerializer.class) @JsonProperty("amount")
public BigDecimal getAmount() {
return amount;
}
}