Class VeniceJsonSerializer<T>

java.lang.Object
com.linkedin.venice.helix.VeniceJsonSerializer<T>
All Implemented Interfaces:
VeniceSerializer<T>
Direct Known Subclasses:
MigrationPushStrategyJSONSerializer, OfflinePushStatusJSONSerializer, PartitionStatusJSONSerializer, RouterClusterConfigJSONSerializer, StoragePersonaJSONSerializer, StoreConfigJsonSerializer, StoreJSONSerializer, StringToLongMapJSONSerializer, SystemStoreJSONSerializer

public class VeniceJsonSerializer<T> extends Object implements VeniceSerializer<T>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final com.fasterxml.jackson.databind.ObjectMapper
    Instance-level ObjectMapper to avoid shared state and race conditions.
  • Constructor Summary

    Constructors
    Constructor
    Description
    VeniceJsonSerializer(com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    configureObjectMapper(com.fasterxml.jackson.databind.ObjectMapper mapper)
    Configure the ObjectMapper with custom settings.
    protected final com.fasterxml.jackson.databind.ObjectMapper
    Creates a new ObjectMapper instance with default Venice configuration.
    deserialize(byte[] bytes, String path)
     
    protected com.fasterxml.jackson.databind.ObjectMapper
    Get the ObjectMapper instance for this serializer.
    byte[]
    serialize(T object, String path)
     

    Methods inherited from class java.lang.Object

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

    • objectMapper

      protected final com.fasterxml.jackson.databind.ObjectMapper objectMapper
      Instance-level ObjectMapper to avoid shared state and race conditions. Each serializer gets its own configured ObjectMapper instance.
  • Constructor Details

    • VeniceJsonSerializer

      public VeniceJsonSerializer(Class<T> type)
    • VeniceJsonSerializer

      public VeniceJsonSerializer(com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
  • Method Details

    • createObjectMapper

      protected final com.fasterxml.jackson.databind.ObjectMapper createObjectMapper()
      Creates a new ObjectMapper instance with default Venice configuration. This is final to prevent it being called from constructor in an unsafe way. Subclasses should use configureObjectMapper() to customize the ObjectMapper.
    • configureObjectMapper

      protected void configureObjectMapper(com.fasterxml.jackson.databind.ObjectMapper mapper)
      Configure the ObjectMapper with custom settings. Subclasses should override this method instead of createObjectMapper().
      Parameters:
      mapper - The ObjectMapper to configure
    • getObjectMapper

      protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
      Get the ObjectMapper instance for this serializer. Protected to allow subclasses to access it for configuration.
    • serialize

      public byte[] serialize(T object, String path) throws IOException
      Specified by:
      serialize in interface VeniceSerializer<T>
      Throws:
      IOException
    • deserialize

      public T deserialize(byte[] bytes, String path) throws IOException
      Specified by:
      deserialize in interface VeniceSerializer<T>
      Throws:
      IOException