Permalink
Browse files

FIX: FixedPrecision annotated element is not always a Field

  • Loading branch information...
xhanin committed Nov 19, 2014
1 parent 9c5ffc4 commit a32a726b5b196017eb16b66500190d11e405ce6b
Showing with 2 additions and 1 deletion.
  1. +2 −1 restx-jongo/src/main/java/restx/jackson/FixedPrecisionSerializer.java
@@ -10,6 +10,7 @@
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import java.io.IOException;
+import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.math.BigDecimal;
@@ -43,7 +44,7 @@ public void serialize(BigDecimal value, JsonGenerator jgen, SerializerProvider p
public JsonSerializer<?> createContextual(SerializerProvider prov, BeanProperty property) throws JsonMappingException {
Member member = property.getMember().getMember();
if (member instanceof Field) {
- FixedPrecision fixedPrecision = ((Field) member).getAnnotation(FixedPrecision.class);
+ FixedPrecision fixedPrecision = ((AnnotatedElement) member).getAnnotation(FixedPrecision.class);
if (fixedPrecision != null) {
return new FixedPrecisionSerializer(fixedPrecision.value());
}

0 comments on commit a32a726

Please sign in to comment.