Class SerializerConfigImpl
- java.lang.Object
-
- org.apache.flink.api.common.serialization.SerializerConfigImpl
-
- All Implemented Interfaces:
Serializable
,SerializerConfig
@Internal public final class SerializerConfigImpl extends Object implements SerializerConfig
The default implement ofSerializerConfig
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SerializerConfigImpl()
SerializerConfigImpl(Configuration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDefaultKryoSerializer(Class<?> type, Class<? extends com.esotericsoftware.kryo.Serializer<?>> serializerClass)
Adds a new Kryo default serializer to the Runtime.<T extends com.esotericsoftware.kryo.Serializer<?> & Serializable>
voidaddDefaultKryoSerializer(Class<?> type, T serializer)
Adds a new Kryo default serializer to the Runtime.void
configure(ReadableConfig configuration, ClassLoader classLoader)
Sets all relevant options contained in theReadableConfig
such as e.g.SerializerConfigImpl
copy()
boolean
equals(Object obj)
LinkedHashMap<Class<?>,Class<? extends com.esotericsoftware.kryo.Serializer<?>>>
getDefaultKryoSerializerClasses()
Returns the registered default Kryo Serializer classes.LinkedHashMap<Class<?>,SerializableSerializer<?>>
getDefaultKryoSerializers()
Returns the registered default Kryo Serializers.LinkedHashSet<Class<?>>
getRegisteredKryoTypes()
Returns the registered Kryo types.LinkedHashSet<Class<?>>
getRegisteredPojoTypes()
Returns the registered POJO types.Map<Class<?>,Class<? extends TypeInfoFactory<?>>>
getRegisteredTypeInfoFactories()
Returns the registered type info factories.LinkedHashMap<Class<?>,Class<? extends com.esotericsoftware.kryo.Serializer<?>>>
getRegisteredTypesWithKryoSerializerClasses()
Returns the registered types with their Kryo Serializer classes.LinkedHashMap<Class<?>,SerializableSerializer<?>>
getRegisteredTypesWithKryoSerializers()
Returns the registered types with Kryo Serializers.boolean
hasGenericTypesDisabled()
Checks whether generic types are supported.int
hashCode()
boolean
isForceAvroEnabled()
Returns whether the Apache Avro is the serializer for POJOs.TernaryBoolean
isForceKryoAvroEnabled()
Returns whether forces Flink to register Apache Avro classes in Kryo serializer.boolean
isForceKryoEnabled()
Returns whether Kryo is the serializer for POJOs.void
registerKryoType(Class<?> type)
Registers the given type with the serialization stack.void
registerPojoType(Class<?> type)
Registers the given type with the serialization stack.void
registerTypeWithKryoSerializer(Class<?> type, Class<? extends com.esotericsoftware.kryo.Serializer> serializerClass)
Registers the given Serializer via its class as a serializer for the given type at the KryoSerializer.<T extends com.esotericsoftware.kryo.Serializer<?> & Serializable>
voidregisterTypeWithKryoSerializer(Class<?> type, T serializer)
Registers the given type with a Kryo Serializer.void
setForceAvro(boolean forceAvro)
The method will be converted to private in the next Flink major version after removing its deprecated caller methods.void
setForceKryo(boolean forceKryo)
The method will be converted to private in the next Flink major version after removing its deprecated caller methods.void
setForceKryoAvro(boolean forceKryoAvro)
The method will be converted to private in the next Flink major version after removing its deprecated caller methods.void
setGenericTypes(boolean genericTypes)
The method will be converted to private in the next Flink major version after removing its deprecated caller methods.String
toString()
-
-
-
Constructor Detail
-
SerializerConfigImpl
public SerializerConfigImpl()
-
SerializerConfigImpl
@Internal public SerializerConfigImpl(Configuration configuration)
-
-
Method Detail
-
addDefaultKryoSerializer
public <T extends com.esotericsoftware.kryo.Serializer<?> & Serializable> void addDefaultKryoSerializer(Class<?> type, T serializer)
Adds a new Kryo default serializer to the Runtime.Note that the serializer instance must be serializable (as defined by java.io.Serializable), because it may be distributed to the worker nodes by java serialization.
- Specified by:
addDefaultKryoSerializer
in interfaceSerializerConfig
- Parameters:
type
- The class of the types serialized with the given serializer.serializer
- The serializer to use.
-
addDefaultKryoSerializer
public void addDefaultKryoSerializer(Class<?> type, Class<? extends com.esotericsoftware.kryo.Serializer<?>> serializerClass)
Adds a new Kryo default serializer to the Runtime.- Specified by:
addDefaultKryoSerializer
in interfaceSerializerConfig
- Parameters:
type
- The class of the types serialized with the given serializer.serializerClass
- The class of the serializer to use.
-
registerTypeWithKryoSerializer
public <T extends com.esotericsoftware.kryo.Serializer<?> & Serializable> void registerTypeWithKryoSerializer(Class<?> type, T serializer)
Registers the given type with a Kryo Serializer.Note that the serializer instance must be serializable (as defined by java.io.Serializable), because it may be distributed to the worker nodes by java serialization.
- Specified by:
registerTypeWithKryoSerializer
in interfaceSerializerConfig
- Parameters:
type
- The class of the types serialized with the given serializer.serializer
- The serializer to use.
-
registerTypeWithKryoSerializer
public void registerTypeWithKryoSerializer(Class<?> type, Class<? extends com.esotericsoftware.kryo.Serializer> serializerClass)
Registers the given Serializer via its class as a serializer for the given type at the KryoSerializer.- Specified by:
registerTypeWithKryoSerializer
in interfaceSerializerConfig
- Parameters:
type
- The class of the types serialized with the given serializer.serializerClass
- The class of the serializer to use.
-
registerPojoType
public void registerPojoType(Class<?> type)
Registers the given type with the serialization stack. If the type is eventually serialized as a POJO, then the type is registered with the POJO serializer. If the type ends up being serialized with Kryo, then it will be registered at Kryo to make sure that only tags are written.- Specified by:
registerPojoType
in interfaceSerializerConfig
- Parameters:
type
- The class of the type to register.
-
registerKryoType
public void registerKryoType(Class<?> type)
Registers the given type with the serialization stack. If the type is eventually serialized as a POJO, then the type is registered with the POJO serializer. If the type ends up being serialized with Kryo, then it will be registered at Kryo to make sure that only tags are written.- Specified by:
registerKryoType
in interfaceSerializerConfig
- Parameters:
type
- The class of the type to register.
-
getRegisteredTypesWithKryoSerializers
public LinkedHashMap<Class<?>,SerializableSerializer<?>> getRegisteredTypesWithKryoSerializers()
Returns the registered types with Kryo Serializers.
-
getRegisteredTypesWithKryoSerializerClasses
public LinkedHashMap<Class<?>,Class<? extends com.esotericsoftware.kryo.Serializer<?>>> getRegisteredTypesWithKryoSerializerClasses()
Returns the registered types with their Kryo Serializer classes.- Specified by:
getRegisteredTypesWithKryoSerializerClasses
in interfaceSerializerConfig
-
getDefaultKryoSerializers
public LinkedHashMap<Class<?>,SerializableSerializer<?>> getDefaultKryoSerializers()
Returns the registered default Kryo Serializers.
-
getDefaultKryoSerializerClasses
public LinkedHashMap<Class<?>,Class<? extends com.esotericsoftware.kryo.Serializer<?>>> getDefaultKryoSerializerClasses()
Returns the registered default Kryo Serializer classes.- Specified by:
getDefaultKryoSerializerClasses
in interfaceSerializerConfig
-
getRegisteredKryoTypes
public LinkedHashSet<Class<?>> getRegisteredKryoTypes()
Returns the registered Kryo types.- Specified by:
getRegisteredKryoTypes
in interfaceSerializerConfig
-
getRegisteredPojoTypes
public LinkedHashSet<Class<?>> getRegisteredPojoTypes()
Returns the registered POJO types.- Specified by:
getRegisteredPojoTypes
in interfaceSerializerConfig
-
getRegisteredTypeInfoFactories
public Map<Class<?>,Class<? extends TypeInfoFactory<?>>> getRegisteredTypeInfoFactories()
Returns the registered type info factories.- Specified by:
getRegisteredTypeInfoFactories
in interfaceSerializerConfig
-
hasGenericTypesDisabled
public boolean hasGenericTypesDisabled()
Checks whether generic types are supported. Generic types are types that go through Kryo during serialization.Generic types are enabled by default.
- Specified by:
hasGenericTypesDisabled
in interfaceSerializerConfig
-
setGenericTypes
public void setGenericTypes(boolean genericTypes)
Description copied from interface:SerializerConfig
The method will be converted to private in the next Flink major version after removing its deprecated caller methods.- Specified by:
setGenericTypes
in interfaceSerializerConfig
-
isForceKryoEnabled
public boolean isForceKryoEnabled()
Returns whether Kryo is the serializer for POJOs.- Specified by:
isForceKryoEnabled
in interfaceSerializerConfig
-
setForceKryo
public void setForceKryo(boolean forceKryo)
Description copied from interface:SerializerConfig
The method will be converted to private in the next Flink major version after removing its deprecated caller methods.- Specified by:
setForceKryo
in interfaceSerializerConfig
-
isForceAvroEnabled
public boolean isForceAvroEnabled()
Returns whether the Apache Avro is the serializer for POJOs.- Specified by:
isForceAvroEnabled
in interfaceSerializerConfig
-
setForceAvro
public void setForceAvro(boolean forceAvro)
Description copied from interface:SerializerConfig
The method will be converted to private in the next Flink major version after removing its deprecated caller methods.- Specified by:
setForceAvro
in interfaceSerializerConfig
-
setForceKryoAvro
public void setForceKryoAvro(boolean forceKryoAvro)
Description copied from interface:SerializerConfig
The method will be converted to private in the next Flink major version after removing its deprecated caller methods.- Specified by:
setForceKryoAvro
in interfaceSerializerConfig
-
isForceKryoAvroEnabled
public TernaryBoolean isForceKryoAvroEnabled()
Description copied from interface:SerializerConfig
Returns whether forces Flink to register Apache Avro classes in Kryo serializer.- Specified by:
isForceKryoAvroEnabled
in interfaceSerializerConfig
-
configure
public void configure(ReadableConfig configuration, ClassLoader classLoader)
Sets all relevant options contained in theReadableConfig
such as e.g.PipelineOptions.FORCE_KRYO
.It will change the value of a setting only if a corresponding option was set in the
configuration
. If a key is not present, the current value of a field will remain untouched.- Specified by:
configure
in interfaceSerializerConfig
- Parameters:
configuration
- a configuration to read the values fromclassLoader
- a class loader to use when loading classes
-
copy
public SerializerConfigImpl copy()
- Specified by:
copy
in interfaceSerializerConfig
-
-