com.hazelcast.config

## Class SerializationConfig

- java.lang.Object
- - com.hazelcast.config.SerializationConfig

-     public class SerializationConfig
      extends Object

  Contains the serialization configuration of `HazelcastInstance`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SerializationConfig()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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 versions of the same class that have changes on the class, like adding/removing a field or changing a type of a field.
    `Collection<SerializerConfig>` | `getSerializerConfigs()`
    `boolean` | `isAllowUnsafe()` Unsafe, it is not public api of java.
    `boolean` | `isCheckClassDefErrors()` Default value is `true` (enabled).
    `boolean` | `isEnableCompression()` Enables compression when default java serialization is used.
    `boolean` | `isEnableSharedObject()` Enables shared object when default java serialization is used.
    `boolean` | `isUseNativeByteOrder()`
    `SerializationConfig` | `setAllowUnsafe(boolean allowUnsafe)` Unsafe, it 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 for 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:
        the global serializer configuration
      See Also:
        `GlobalSerializerConfig`

    - #### setGlobalSerializerConfig

          public SerializationConfig setGlobalSerializerConfig(GlobalSerializerConfig globalSerializerConfig)

      Parameters:
        `globalSerializerConfig` - configuration of serializer that will be used 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 versions of the same class that have changes on the class, like adding/removing a field or changing a type of a field.
      Returns:
        version of portable classes

    - #### setPortableVersion

          public SerializationConfig setPortableVersion(int portableVersion)

      Parameters:
        `portableVersion` - int value for the 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:
        `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:
        `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:
        `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:
        `DataSerializableFactory`

    - #### getDataSerializableFactories

          public Map<Integer,DataSerializableFactory> getDataSerializableFactories()

      Returns:
        map of factory ID and corresponding dataSerializable factories
      See Also:
        `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:
        `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:
        `DataSerializableFactory`

    - #### getPortableFactoryClasses

          public Map<Integer,String> getPortableFactoryClasses()

      Returns:
        map of factory ID and corresponding portable factory names
      See Also:
        `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:
        `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:
        `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:
        `PortableFactory`

    - #### getPortableFactories

          public Map<Integer,PortableFactory> getPortableFactories()

      Returns:
        map of factory ID and corresponding portable factories
      See Also:
        `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:
        `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:
        `PortableFactory`

    - #### getClassDefinitions

          public Set<ClassDefinition> getClassDefinitions()

      Returns:
        registered class definitions of portable classes
      See Also:
        `ClassDefinition`

    - #### addClassDefinition

          public SerializationConfig addClassDefinition(ClassDefinition classDefinition)

      Parameters:
        `classDefinition` - the class definition to be registered
      Returns:
        configured `SerializerConfig` for chaining
      See Also:
        `ClassDefinition`

    - #### setClassDefinitions

          public SerializationConfig setClassDefinitions(Set<ClassDefinition> classDefinitions)

      Parameters:
        `classDefinitions` - set of class definitions to be registered
      Returns:
        configured `SerializerConfig` for chaining
      See Also:
        `ClassDefinition`

    - #### isCheckClassDefErrors

          public boolean isCheckClassDefErrors()

      Default value is `true` (enabled). When enabled, serialization system will check for class definitions error at start and throw an Serialization Exception with error definition.
      Returns:
        `true` if enabled, `false` otherwise

    - #### setCheckClassDefErrors

          public SerializationConfig setCheckClassDefErrors(boolean checkClassDefErrors)

      When enabled, serialization system will check for 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 to 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 compression enabled

    - #### setEnableCompression

          public SerializationConfig setEnableCompression(boolean enableCompression)

      Enables compression when default java serialization is used.
      Parameters:
        `enableCompression` - set to `true` to enable compression
      Returns:
        configured `SerializerConfig` for chaining

    - #### isEnableSharedObject

          public boolean isEnableSharedObject()

      Enables shared object when default java serialization is used.

      Default value is `true`.

      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()

      Unsafe, it is not public api of java. Use with caution!

      Default value is `false`.

      Returns:
        `true` if using unsafe is allowed, `false` otherwise

    - #### setAllowUnsafe

          public SerializationConfig setAllowUnsafe(boolean allowUnsafe)

      Unsafe, it 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 © 2018. All rights reserved.