Class RoundingUtils.SignificantDigitsSerializer
java.lang.Object
com.fasterxml.jackson.databind.JsonSerializer<Double>
ubic.gemma.core.util.RoundingUtils.SignificantDigitsSerializer
- All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable
- Enclosing class:
RoundingUtils
public static class RoundingUtils.SignificantDigitsSerializer
extends com.fasterxml.jackson.databind.JsonSerializer<Double>
Applies
RoundingUtils.round(double) at serialization time, leaving the in-memory value exact.
Use this rather than rounding in a value object's constructor wherever the field is also read by application code — the differential-expression endpoints rank rows by corrected p-value, and rounding before the sort can reorder near-ties.
Opt in per field with @JsonSerialize(using = RoundingUtils.SignificantDigitsSerializer.class).
It is deliberately not registered on the shared ObjectMapper: that would also round GEEQ scores
and thresholds.
- Author:
- paul
-
Nested Class Summary
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer
com.fasterxml.jackson.databind.JsonSerializer.None -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer
acceptJsonFormatVisitor, getDelegatee, handledType, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, serializeWithType, unwrappingSerializer, usesObjectId, withFilterId, withIgnoredProperties
-
Constructor Details
-
SignificantDigitsSerializer
public SignificantDigitsSerializer()
-
-
Method Details
-
serialize
public void serialize(Double value, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider serializers) throws IOException - Specified by:
serializein classcom.fasterxml.jackson.databind.JsonSerializer<Double>- Throws:
IOException
-