Package com.linkedin.venice.helix
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
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.fasterxml.jackson.databind.ObjectMapperInstance-level ObjectMapper to avoid shared state and race conditions. -
Constructor Summary
ConstructorsConstructorDescriptionVeniceJsonSerializer(com.fasterxml.jackson.core.type.TypeReference<T> typeReference) VeniceJsonSerializer(Class<T> type) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigureObjectMapper(com.fasterxml.jackson.databind.ObjectMapper mapper) Configure the ObjectMapper with custom settings.protected final com.fasterxml.jackson.databind.ObjectMapperCreates a new ObjectMapper instance with default Venice configuration.deserialize(byte[] bytes, String path) protected com.fasterxml.jackson.databind.ObjectMapperGet the ObjectMapper instance for this serializer.byte[]
-
Field Details
-
objectMapper
protected final com.fasterxml.jackson.databind.ObjectMapper objectMapperInstance-level ObjectMapper to avoid shared state and race conditions. Each serializer gets its own configured ObjectMapper instance.
-
-
Constructor Details
-
VeniceJsonSerializer
-
VeniceJsonSerializer
-
-
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
- Specified by:
serializein interfaceVeniceSerializer<T>- Throws:
IOException
-
deserialize
- Specified by:
deserializein interfaceVeniceSerializer<T>- Throws:
IOException
-