Class SummarySerializer<S extends DbPojo,​D extends DbPojo>

java.lang.Object
com.fasterxml.jackson.databind.JsonSerializer<SummarySerializer.Summary<S,​D>>
tenapull.data.deserialize.SummarySerializer<S,​D>
Type Parameters:
S - The general-info ("summary") entity from the DB
D - The more detailed-info ("details") entity from the DB
All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable

public class SummarySerializer<S extends DbPojo,​D extends DbPojo>
extends com.fasterxml.jackson.databind.JsonSerializer<SummarySerializer.Summary<S,​D>>
Used when outputting records, for serializing the "summary" wrapper objects inside the HostVulnerabilityOutput entity. These summary wrapper objects must implement the Summary interface provided as an inner interface in this serializer.
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static interface  SummarySerializer.Summary<S extends DbPojo,​D extends DbPojo>
    The interface that must be implemented by the summary wrappers being serialized

    Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer

    com.fasterxml.jackson.databind.JsonSerializer.None
  • Constructor Summary

    Constructors 
    Constructor Description
    SummarySerializer()  
  • Method Summary

    Modifier and Type Method Description
    void serialize​(SummarySerializer.Summary<S,​D> container, com.fasterxml.jackson.core.JsonGenerator jg, com.fasterxml.jackson.databind.SerializerProvider sp)
    Obtains the summary and detail entities from a summary wrapper, and converts them into JsonObjects using the same mapper being invoked.

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

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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • serialize

      public void serialize​(SummarySerializer.Summary<S,​D> container, com.fasterxml.jackson.core.JsonGenerator jg, com.fasterxml.jackson.databind.SerializerProvider sp) throws java.io.IOException
      Obtains the summary and detail entities from a summary wrapper, and converts them into JsonObjects using the same mapper being invoked. Then takes the two JsonObjects and compares keys, eliminating any redundant keys in the detail entity (as long as the values are identical with the summary entity's). Then nests the details entity in the summary entity using the key provided by getDetailsKey(), and writes the resulting JsonObject to the current serialization JsonGenerator
      Specified by:
      serialize in class com.fasterxml.jackson.databind.JsonSerializer<SummarySerializer.Summary<S extends DbPojo,​D extends DbPojo>>
      Parameters:
      container - the wrapper entity implementing the SummarySerializer.Summary interface
      jg -
      sp -
      Throws:
      java.io.IOException