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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    serialize(Double value, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider serializers)
     

    Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer

    acceptJsonFormatVisitor, getDelegatee, handledType, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, serializeWithType, unwrappingSerializer, usesObjectId, withFilterId, withIgnoredProperties

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      serialize in class com.fasterxml.jackson.databind.JsonSerializer<Double>
      Throws:
      IOException