com.hazelcast.config

## Class CollectionConfig<T extends CollectionConfig>

- java.lang.Object
- - com.hazelcast.config.CollectionConfig<T>

- Type Parameters:
    `T` - Type of Collection such as List, Set
  All Implemented Interfaces:
    NamedConfig, DataSerializable, IdentifiedDataSerializable, com.hazelcast.nio.serialization.impl.Versioned, SplitBrainMergeTypeProvider
  Direct Known Subclasses:
    ListConfig, SetConfig

      public abstract class CollectionConfig<T extends CollectionConfig>
      extends Object
      implements SplitBrainMergeTypeProvider, IdentifiedDataSerializable, com.hazelcast.nio.serialization.impl.Versioned, NamedConfig

  Provides configuration service for Collection.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_ASYNC_BACKUP_COUNT` The default number of asynchronous backups
    `static int` | `DEFAULT_MAX_SIZE` Default maximum size for the Configuration.
    `static int` | `DEFAULT_SYNC_BACKUP_COUNT` The default number of synchronous backups

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `CollectionConfig()`
    `protected` | `CollectionConfig(CollectionConfig config)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addItemListenerConfig(ItemListenerConfig itemListenerConfig)` Adds an item listener to this collection (listens for when items are added or removed).
    `boolean` | `equals(Object o)`
    `protected String` | `fieldsToString()` Returns field names with values as concatenated String so it can be used in child classes' toString() methods.
    `abstract T` | `getAsReadOnly()`
    `int` | `getAsyncBackupCount()` Gets the number of asynchronous backups.
    `int` | `getBackupCount()` Gets the number of synchronous backups for this collection.
    `int` | `getFactoryId()` Returns DataSerializableFactory factory ID for this class.
    `List<ItemListenerConfig>` | `getItemListenerConfigs()` Gets the list of ItemListenerConfigs.
    `int` | `getMaxSize()` Gets the maximum size for the Configuration.
    `MergePolicyConfig` | `getMergePolicyConfig()` Gets the `MergePolicyConfig` for the collection.
    `String` | `getName()` Gets the name of this collection.
    `Class` | `getProvidedMergeTypes()`
    `String` | `getQuorumName()` Returns the quorum name for operations.
    `int` | `getTotalBackupCount()` Gets the total number of synchronous and asynchronous backups for this collection.
    `int` | `hashCode()`
    `boolean` | `isStatisticsEnabled()` Checks if collection statistics are enabled.
    `void` | `readData(ObjectDataInput in)` Reads fields from the input stream
    `T` | `setAsyncBackupCount(int asyncBackupCount)` Sets the number of asynchronous backups.
    `T` | `setBackupCount(int backupCount)` Sets the number of synchronous backups for this collection.
    `T` | `setItemListenerConfigs(List<ItemListenerConfig> listenerConfigs)` Sets the list of ItemListenerConfigs.
    `T` | `setMaxSize(int maxSize)` Sets the maximum size for the collection.
    `T` | `setMergePolicyConfig(MergePolicyConfig mergePolicyConfig)` Sets the `MergePolicyConfig` for the collection.
    `T` | `setName(String name)` Sets the name of this collection.
    `T` | `setQuorumName(String quorumName)` Sets the quorum name for operations.
    `T` | `setStatisticsEnabled(boolean statisticsEnabled)` Sets collection statistics to enabled or disabled.
    `void` | `writeData(ObjectDataOutput out)` Writes object fields to output stream

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.hazelcast.nio.serialization.IdentifiedDataSerializable

      `getId`

- - ### Field Detail

    - #### DEFAULT_MAX_SIZE

          public static final int DEFAULT_MAX_SIZE

      Default maximum size for the Configuration.
      See Also:
        Constant Field Values

    - #### DEFAULT_SYNC_BACKUP_COUNT

          public static final int DEFAULT_SYNC_BACKUP_COUNT

      The default number of synchronous backups
      See Also:
        Constant Field Values

    - #### DEFAULT_ASYNC_BACKUP_COUNT

          public static final int DEFAULT_ASYNC_BACKUP_COUNT

      The default number of asynchronous backups
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### CollectionConfig

          protected CollectionConfig()

    - #### CollectionConfig

          protected CollectionConfig(CollectionConfig config)

  - ### Method Detail

    - #### getAsReadOnly

          public abstract T getAsReadOnly()

    - #### getName

          public String getName()

      Gets the name of this collection.
      Specified by:
        `getName` in interface `NamedConfig`
      Returns:
        the name of this collection

    - #### setName

          public T setName(String name)

      Sets the name of this collection.
      Specified by:
        `setName` in interface `NamedConfig`
      Parameters:
        `name` - the name of this collection
      Returns:
        the updated collection configuration

    - #### getItemListenerConfigs

          public List<ItemListenerConfig> getItemListenerConfigs()

      Gets the list of ItemListenerConfigs.
      Returns:
        the list of ItemListenerConfigs

    - #### setItemListenerConfigs

          public T setItemListenerConfigs(List<ItemListenerConfig> listenerConfigs)

      Sets the list of ItemListenerConfigs.
      Parameters:
        `listenerConfigs` - the list of ItemListenerConfigs to set
      Returns:
        this collection configuration

    - #### getTotalBackupCount

          public int getTotalBackupCount()

      Gets the total number of synchronous and asynchronous backups for this collection.
      Returns:
        the total number of synchronous and asynchronous backups for this collection

    - #### getBackupCount

          public int getBackupCount()

      Gets the number of synchronous backups for this collection.
      Returns:
        the number of synchronous backups for this collection

    - #### setBackupCount

          public T setBackupCount(int backupCount)

      Sets the number of synchronous backups for this collection.
      Parameters:
        `backupCount` - the number of synchronous backups to set for this collection
      Returns:
        the current CollectionConfig
      Throws:
        `IllegalArgumentException` - if backupCount smaller than 0, or larger than the maximum number of backup or the sum of the backups and async backups is larger than the maximum number of backups
      See Also:
        `setAsyncBackupCount(int)`

    - #### getAsyncBackupCount

          public int getAsyncBackupCount()

      Gets the number of asynchronous backups.
      Returns:
        the number of asynchronous backups

    - #### setAsyncBackupCount

          public T setAsyncBackupCount(int asyncBackupCount)

      Sets the number of asynchronous backups.
      Parameters:
        `asyncBackupCount` - the number of asynchronous synchronous backups to set
      Returns:
        the updated CollectionConfig
      Throws:
        `IllegalArgumentException` - if asyncBackupCount is smaller than 0, or larger than the maximum number of backups, or the sum of the backups and async backups is larger than the maximum number of backups.
      See Also:
        `setBackupCount(int)`, `getAsyncBackupCount()`

    - #### getMaxSize

          public int getMaxSize()

      Gets the maximum size for the Configuration.
      Returns:
        the maximum size for the Configuration

    - #### setMaxSize

          public T setMaxSize(int maxSize)

      Sets the maximum size for the collection.
      Returns:
        the current CollectionConfig

    - #### isStatisticsEnabled

          public boolean isStatisticsEnabled()

      Checks if collection statistics are enabled.
      Returns:
        `true` if collection statistics are enabled, `false` otherwise

    - #### setStatisticsEnabled

          public T setStatisticsEnabled(boolean statisticsEnabled)

      Sets collection statistics to enabled or disabled.
      Parameters:
        `statisticsEnabled` - `true` to enable collection statistics, `false` to disable
      Returns:
        the current collection config instance

    - #### addItemListenerConfig

          public void addItemListenerConfig(ItemListenerConfig itemListenerConfig)

      Adds an item listener to this collection (listens for when items are added or removed).
      Parameters:
        `itemListenerConfig` - the item listener to add to this collection

    - #### getQuorumName

          public String getQuorumName()

      Returns the quorum name for operations.
      Returns:
        the quorum name

    - #### setQuorumName

          public T setQuorumName(String quorumName)

      Sets the quorum name for operations.
      Parameters:
        `quorumName` - the quorum name
      Returns:
        the updated configuration

    - #### getMergePolicyConfig

          public MergePolicyConfig getMergePolicyConfig()

      Gets the `MergePolicyConfig` for the collection.
      Returns:
        the `MergePolicyConfig` for the collection

    - #### setMergePolicyConfig

          public T setMergePolicyConfig(MergePolicyConfig mergePolicyConfig)

      Sets the `MergePolicyConfig` for the collection.
      Returns:
        the current CollectionConfig

    - #### getProvidedMergeTypes

          public Class getProvidedMergeTypes()

      Specified by:
        `getProvidedMergeTypes` in interface `SplitBrainMergeTypeProvider`

    - #### getFactoryId

          public int getFactoryId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns DataSerializableFactory factory ID for this class.
      Specified by:
        `getFactoryId` in interface `IdentifiedDataSerializable`
      Returns:
        factory ID

    - #### writeData

          public void writeData(ObjectDataOutput out)
                         throws IOException

      Description copied from interface: `DataSerializable`
      Writes object fields to output stream
      Specified by:
        `writeData` in interface `DataSerializable`
      Parameters:
        `out` - output
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the output stream has been closed.

    - #### readData

          public void readData(ObjectDataInput in)
                        throws IOException

      Description copied from interface: `DataSerializable`
      Reads fields from the input stream
      Specified by:
        `readData` in interface `DataSerializable`
      Parameters:
        `in` - input
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the input stream has been closed.

    - #### equals

          public final boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public final int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### fieldsToString

          protected String fieldsToString()

      Returns field names with values as concatenated String so it can be used in child classes' toString() methods.

Copyright © 2020. All rights reserved.