Package tenapull.data.deserialize
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 DBD
- 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 -
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.
-
Constructor Details
-
SummarySerializer
public SummarySerializer()
-
-
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.IOExceptionObtains 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 classcom.fasterxml.jackson.databind.JsonSerializer<SummarySerializer.Summary<S extends DbPojo,D extends DbPojo>>
- Parameters:
container
- the wrapper entity implementing the SummarySerializer.Summary interfacejg
-sp
-- Throws:
java.io.IOException
-