com.hazelcast.config
Class SerializationConfig

java.lang.Object
  extended by com.hazelcast.config.SerializationConfig

public class SerializationConfig
extends Object

Contains the serialization configuration of HazelcastInstance.


Constructor Summary
SerializationConfig()
           
 
Method Summary
 SerializationConfig addClassDefinition(ClassDefinition classDefinition)
           
 SerializationConfig addDataSerializableFactory(int factoryId, DataSerializableFactory dataSerializableFactory)
           
 SerializationConfig addDataSerializableFactoryClass(int factoryId, Class<? extends DataSerializableFactory> dataSerializableFactoryClass)
           
 SerializationConfig addDataSerializableFactoryClass(int factoryId, String dataSerializableFactoryClass)
           
 SerializationConfig addPortableFactory(int factoryId, PortableFactory portableFactory)
           
 SerializationConfig addPortableFactoryClass(int factoryId, Class<? extends PortableFactory> portableFactoryClass)
           
 SerializationConfig addPortableFactoryClass(int factoryId, String portableFactoryClass)
           
 SerializationConfig addSerializerConfig(SerializerConfig serializerConfig)
           
 ByteOrder getByteOrder()
          Note that result of useNativeByteOrder is not reflected to return value of this method.
 Set<ClassDefinition> getClassDefinitions()
           
 Map<Integer,DataSerializableFactory> getDataSerializableFactories()
           
 Map<Integer,String> getDataSerializableFactoryClasses()
           
 GlobalSerializerConfig getGlobalSerializerConfig()
           
 Map<Integer,PortableFactory> getPortableFactories()
           
 Map<Integer,String> getPortableFactoryClasses()
           
 int getPortableVersion()
          Portable version will be used to differentiate two same class that have changes on it , like adding/removing field or changing a type of a field.
 Collection<SerializerConfig> getSerializerConfigs()
           
 boolean isAllowUnsafe()
          Default value is false.
 boolean isCheckClassDefErrors()
          Default value is true.
 boolean isEnableCompression()
          Enables compression when default java serialization is used.
 boolean isEnableSharedObject()
          Default value is true.
 boolean isUseNativeByteOrder()
           
 SerializationConfig setAllowUnsafe(boolean allowUnsafe)
          Unsafe is not public api of java.
 SerializationConfig setByteOrder(ByteOrder byteOrder)
          Not that configuring use native byte order as enabled will override the byte order set by this method.
 SerializationConfig setCheckClassDefErrors(boolean checkClassDefErrors)
          When enabled, serialization system will check class definitions error at start and throw an Serialization Exception with error definition.
 SerializationConfig setClassDefinitions(Set<ClassDefinition> classDefinitions)
           
 SerializationConfig setDataSerializableFactories(Map<Integer,DataSerializableFactory> dataSerializableFactories)
           
 SerializationConfig setDataSerializableFactoryClasses(Map<Integer,String> dataSerializableFactoryClasses)
           
 SerializationConfig setEnableCompression(boolean enableCompression)
          Enables compression when default java serialization is used.
 SerializationConfig setEnableSharedObject(boolean enableSharedObject)
          Enables shared object when default java serialization is used.
 SerializationConfig setGlobalSerializerConfig(GlobalSerializerConfig globalSerializerConfig)
           
 SerializationConfig setPortableFactories(Map<Integer,PortableFactory> portableFactories)
           
 SerializationConfig setPortableFactoryClasses(Map<Integer,String> portableFactoryClasses)
           
 SerializationConfig setPortableVersion(int portableVersion)
           
 SerializationConfig setSerializerConfigs(Collection<SerializerConfig> serializerConfigs)
           
 SerializationConfig setUseNativeByteOrder(boolean useNativeByteOrder)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SerializationConfig

public SerializationConfig()
Method Detail

getGlobalSerializerConfig

public GlobalSerializerConfig getGlobalSerializerConfig()
Returns:
global serializer config
See Also:
com.hazelcast.config.GlobalSerializerConfig}

setGlobalSerializerConfig

public SerializationConfig setGlobalSerializerConfig(GlobalSerializerConfig globalSerializerConfig)
Parameters:
globalSerializerConfig - configuration of serializer will be used that if no other serializer is applicable
Returns:
GlobalSerializerConfig

getSerializerConfigs

public Collection<SerializerConfig> getSerializerConfigs()
Returns:
list of SerializerConfig's

addSerializerConfig

public SerializationConfig addSerializerConfig(SerializerConfig serializerConfig)
Parameters:
serializerConfig - serializer configuration of a class type
Returns:
configured SerializerConfig for chaining

setSerializerConfigs

public SerializationConfig setSerializerConfigs(Collection<SerializerConfig> serializerConfigs)
Parameters:
serializerConfigs - lists of serializer configs that will be registered
Returns:
configured SerializerConfig for chaining

getPortableVersion

public int getPortableVersion()
Portable version will be used to differentiate two same class that have changes on it , like adding/removing field or changing a type of a field.

Returns:
version of portable classes

setPortableVersion

public SerializationConfig setPortableVersion(int portableVersion)
Parameters:
portableVersion - int value for version of portable classes
Returns:
configured SerializerConfig for chaining

getDataSerializableFactoryClasses

public Map<Integer,String> getDataSerializableFactoryClasses()
Returns:
map of factory id and corresponding factory class names
See Also:
com.hazelcast.nio.serialization.DataSerializableFactory}

setDataSerializableFactoryClasses

public SerializationConfig setDataSerializableFactoryClasses(Map<Integer,String> dataSerializableFactoryClasses)
Parameters:
dataSerializableFactoryClasses - map of factory id and corresponding factory class names
Returns:
configured SerializerConfig for chaining
See Also:
com.hazelcast.nio.serialization.DataSerializableFactory}

addDataSerializableFactoryClass

public SerializationConfig addDataSerializableFactoryClass(int factoryId,
                                                           String dataSerializableFactoryClass)
Parameters:
factoryId - factory id of dataSerializableFactory to be registered
dataSerializableFactoryClass - name of dataSerializableFactory class to be registered
Returns:
configured SerializerConfig for chaining
See Also:
com.hazelcast.nio.serialization.DataSerializableFactory}

addDataSerializableFactoryClass

public SerializationConfig addDataSerializableFactoryClass(int factoryId,
                                                           Class<? extends DataSerializableFactory> dataSerializableFactoryClass)
Parameters:
factoryId - factory id of dataSerializableFactory to be registered
dataSerializableFactoryClass - dataSerializableFactory class to be registered
Returns:
configured SerializerConfig for chaining
See Also:
com.hazelcast.nio.serialization.DataSerializableFactory}

getDataSerializableFactories

public Map<Integer,DataSerializableFactory> getDataSerializableFactories()
Returns:
map of factory id and corresponding dataSerializable factories
See Also:
com.hazelcast.nio.serialization.DataSerializableFactory}

setDataSerializableFactories

public SerializationConfig setDataSerializableFactories(Map<Integer,DataSerializableFactory> dataSerializableFactories)
Parameters:
dataSerializableFactories - map of factory id and corresponding dataSerializable objects
Returns:
configured SerializerConfig for chaining
See Also:
com.hazelcast.nio.serialization.DataSerializableFactory}

addDataSerializableFactory

public SerializationConfig addDataSerializableFactory(int factoryId,
                                                      DataSerializableFactory dataSerializableFactory)
Parameters:
factoryId - factory id of DataSerializableFactory to be registered
dataSerializableFactory - DataSerializableFactory object to be registered
Returns:
configured SerializerConfig for chaining
See Also:
com.hazelcast.nio.serialization.DataSerializableFactory}

getPortableFactoryClasses

public Map<Integer,String> getPortableFactoryClasses()
Returns:
map of factory id and corresponding portable factory names
See Also:
com.hazelcast.nio.serialization.PortableFactory}

setPortableFactoryClasses

public SerializationConfig setPortableFactoryClasses(Map<Integer,String> portableFactoryClasses)
Parameters:
portableFactoryClasses - map of factory id and corresponding factory class names
Returns:
configured SerializerConfig for chaining
See Also:
com.hazelcast.nio.serialization.PortableFactory}

addPortableFactoryClass

public SerializationConfig addPortableFactoryClass(int factoryId,
                                                   Class<? extends PortableFactory> portableFactoryClass)
Parameters:
factoryId - factory id of portableFactory to be registered
portableFactoryClass - portableFactory class to be registered
Returns:
configured SerializerConfig for chaining
See Also:
com.hazelcast.nio.serialization.PortableFactory}

addPortableFactoryClass

public SerializationConfig addPortableFactoryClass(int factoryId,
                                                   String portableFactoryClass)
Parameters:
factoryId - factory id of portableFactory to be registered
portableFactoryClass - name of the portableFactory class to be registered
Returns:
configured SerializerConfig for chaining
See Also:
com.hazelcast.nio.serialization.PortableFactory}

getPortableFactories

public Map<Integer,PortableFactory> getPortableFactories()
Returns:
map of factory id and corresponding portable factories
See Also:
com.hazelcast.nio.serialization.PortableFactory}

setPortableFactories

public SerializationConfig setPortableFactories(Map<Integer,PortableFactory> portableFactories)
Parameters:
portableFactories - map of factory id and corresponding factory objects
Returns:
configured SerializerConfig for chaining
See Also:
com.hazelcast.nio.serialization.PortableFactory}

addPortableFactory

public SerializationConfig addPortableFactory(int factoryId,
                                              PortableFactory portableFactory)
Parameters:
factoryId - factory id of portableFactory to be registered
portableFactory - portableFactory object to be registered
Returns:
configured SerializerConfig for chaining
See Also:
com.hazelcast.nio.serialization.PortableFactory}

getClassDefinitions

public Set<ClassDefinition> getClassDefinitions()
Returns:
registered class definitions of portable classes
See Also:
com.hazelcast.nio.serialization.ClassDefinition}

addClassDefinition

public SerializationConfig addClassDefinition(ClassDefinition classDefinition)
Parameters:
classDefinition - to be registered
Returns:
configured SerializerConfig for chaining
See Also:
com.hazelcast.nio.serialization.ClassDefinition}

setClassDefinitions

public SerializationConfig setClassDefinitions(Set<ClassDefinition> classDefinitions)
Parameters:
classDefinitions - set of class definitions to be registered
Returns:
configured SerializerConfig for chaining
See Also:
com.hazelcast.nio.serialization.ClassDefinition}

isCheckClassDefErrors

public boolean isCheckClassDefErrors()
Default value is true. When enabled, serialization system will check class definitions error at start and throw an Serialization Exception with error definition.

Returns:
true if enabled.

setCheckClassDefErrors

public SerializationConfig setCheckClassDefErrors(boolean checkClassDefErrors)
When enabled, serialization system will check class definitions error at start and throw an Serialization Exception with error definition.

Parameters:
checkClassDefErrors - set to false to disable.
Returns:
configured SerializerConfig for chaining

isUseNativeByteOrder

public boolean isUseNativeByteOrder()
Returns:
true if serialization is configured as use native byte order of the underlying platform.

setUseNativeByteOrder

public SerializationConfig setUseNativeByteOrder(boolean useNativeByteOrder)
Parameters:
useNativeByteOrder - set to true to use native byte order of the underlying platform.
Returns:
configured SerializerConfig for chaining

getByteOrder

public ByteOrder getByteOrder()
Note that result of useNativeByteOrder is not reflected to return value of this method.

Returns:
configured byte order

setByteOrder

public SerializationConfig setByteOrder(ByteOrder byteOrder)
Not that configuring use native byte order as enabled will override the byte order set by this method.

Parameters:
byteOrder - that serialization will use.
Returns:
configured SerializerConfig for chaining

isEnableCompression

public boolean isEnableCompression()
Enables compression when default java serialization is used.

Returns:
true if enabled.

setEnableCompression

public SerializationConfig setEnableCompression(boolean enableCompression)
Enables compression when default java serialization is used.

Parameters:
enableCompression - set to true to enable
Returns:
configured SerializerConfig for chaining

isEnableSharedObject

public boolean isEnableSharedObject()
Default value is true. Enables shared object when default java serialization is used.

Returns:
true if enabled.

setEnableSharedObject

public SerializationConfig setEnableSharedObject(boolean enableSharedObject)
Enables shared object when default java serialization is used.

Parameters:
enableSharedObject - set to false to disable
Returns:
configured SerializerConfig for chaining

isAllowUnsafe

public boolean isAllowUnsafe()
Default value is false. Unsafe is not public api of java. Use with caution!

Returns:
true if using unsafe is allowed

setAllowUnsafe

public SerializationConfig setAllowUnsafe(boolean allowUnsafe)
Unsafe is not public api of java. Use with caution!

Parameters:
allowUnsafe - set to true to allow usage of unsafe
Returns:
configured SerializerConfig for chaining

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.