com.hazelcast.config

## Class AbstractCacheConfig<K,V>

- java.lang.Object
- - com.hazelcast.config.AbstractCacheConfig<K,V>

- Type Parameters:
    `K` - the key type
    `V` - the value type
  All Implemented Interfaces:
    CacheConfiguration<K,V>, DataSerializable, Serializable, javax.cache.configuration.CompleteConfiguration<K,V>, javax.cache.configuration.Configuration<K,V>
  Direct Known Subclasses:
    CacheConfig

      public abstract class AbstractCacheConfig<K,V>
      extends Object
      implements CacheConfiguration<K,V>, DataSerializable

  Base class for `CacheConfig`
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected com.hazelcast.cache.impl.DeferredValue<javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>>>` | `cacheLoaderFactory` The `Factory` for the `CacheLoader`.
    `protected com.hazelcast.cache.impl.DeferredValue<javax.cache.configuration.Factory<javax.cache.integration.CacheWriter<? super K,? super V>>>` | `cacheWriterFactory` The `Factory` for the `CacheWriter`.
    `protected ClassLoader` | `classLoader` The ClassLoader to be used to resolve key & value types, if set
    `protected com.hazelcast.cache.impl.DeferredValue<javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy>>` | `expiryPolicyFactory` The `Factory` for the `ExpiryPolicy`.
    `protected HotRestartConfig` | `hotRestartConfig`
    `protected boolean` | `isManagementEnabled` Whether management is enabled
    `protected boolean` | `isReadThrough` A flag indicating if "read-through" mode is required.
    `protected boolean` | `isStatisticsEnabled` A flag indicating if statistics gathering is enabled.
    `protected boolean` | `isStoreByValue` A flag indicating if the cache will be store-by-value or store-by-reference.
    `protected boolean` | `isWriteThrough` A flag indicating if "write-through" mode is required.
    `protected Set<com.hazelcast.cache.impl.DeferredValue<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>>>` | `listenerConfigurations` The `CacheEntryListenerConfiguration`s for the `Configuration`.
    `protected com.hazelcast.internal.serialization.InternalSerializationService` | `serializationService`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractCacheConfig()`
    `AbstractCacheConfig(javax.cache.configuration.CompleteConfiguration<K,V> configuration)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `CacheConfiguration<K,V>` | `addCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)` Add a configuration for a `CacheEntryListener`.
    `protected Set<com.hazelcast.cache.impl.DeferredValue<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>>>` | `createConcurrentSet()`
    `boolean` | `equals(Object o)`
    `Iterable<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>>` | `getCacheEntryListenerConfigurations()`
    `javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>>` | `getCacheLoaderFactory()`
    `javax.cache.configuration.Factory<javax.cache.integration.CacheWriter<? super K,? super V>>` | `getCacheWriterFactory()`
    `javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy>` | `getExpiryPolicyFactory()`
    `HotRestartConfig` | `getHotRestartConfig()` Gets the `HotRestartConfig` for this `CacheConfiguration`
    `String` | `getKeyClassName()`
    `Class<K>` | `getKeyType()`
    `Set<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>>` | `getListenerConfigurations()`
    `String` | `getValueClassName()`
    `Class<V>` | `getValueType()`
    `int` | `hashCode()`
    `protected boolean` | `hasListenerConfiguration()`
    `boolean` | `isManagementEnabled()`
    `boolean` | `isReadThrough()`
    `boolean` | `isStatisticsEnabled()`
    `boolean` | `isStoreByValue()`
    `boolean` | `isWriteThrough()`
    `protected boolean` | `keyValueTypesEqual(AbstractCacheConfig that)`
    `CacheConfiguration<K,V>` | `removeCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)` Remove a configuration for a `CacheEntryListener`.
    `CacheConfiguration<K,V>` | `setCacheLoaderFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheLoader<K,V>> cacheLoaderFactory)` Set the `CacheLoader` factory.
    `CacheConfiguration<K,V>` | `setCacheWriterFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheWriter<? super K,? super V>> cacheWriterFactory)` Set the `CacheWriter` factory.
    `protected void` | `setClassLoader(ClassLoader classLoader)`
    `CacheConfiguration<K,V>` | `setExpiryPolicyFactory(javax.cache.configuration.Factory<? extends javax.cache.expiry.ExpiryPolicy> expiryPolicyFactory)` Set the `Factory` for the `ExpiryPolicy`.
    `CacheConfiguration<K,V>` | `setHotRestartConfig(HotRestartConfig hotRestartConfig)` Sets the `HotRestartConfig` for this `CacheConfiguration`
    `CacheConfiguration<K,V>` | `setKeyClassName(String keyClassName)`
    `CacheConfiguration<K,V>` | `setKeyType(Class<K> keyType)`
    `CacheConfiguration<K,V>` | `setListenerConfigurations()`
    `protected CacheConfiguration<K,V>` | `setListenerConfigurations(Set<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>> listeners)`
    `CacheConfiguration<K,V>` | `setManagementEnabled(boolean enabled)` Sets whether or not management is enabled on this cache.
    `CacheConfiguration<K,V>` | `setReadThrough(boolean isReadThrough)` Set if read-through caching should be used.
    `CacheConfiguration<K,V>` | `setStatisticsEnabled(boolean enabled)` Sets whether or not statistics gathering is enabled on this cache.
    `CacheConfiguration<K,V>` | `setStoreByValue(boolean storeByValue)` Set if a configured cache should use store-by-value or store-by-reference semantics.
    `CacheConfiguration<K,V>` | `setTypes(Class<K> keyType, Class<V> valueType)` Sets the expected type of keys and values for a `Cache` configured with this `Configuration`.
    `CacheConfiguration<K,V>` | `setValueClassName(String valueClassName)`
    `CacheConfiguration<K,V>` | `setValueType(Class<V> valueType)`
    `CacheConfiguration<K,V>` | `setWriteThrough(boolean isWriteThrough)` Set if write-through caching should be used.

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

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

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

      `readData, writeData`

- - ### Field Detail

    - #### cacheLoaderFactory

          protected com.hazelcast.cache.impl.DeferredValue<javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>>> cacheLoaderFactory

      The `Factory` for the `CacheLoader`.

    - #### cacheWriterFactory

          protected com.hazelcast.cache.impl.DeferredValue<javax.cache.configuration.Factory<javax.cache.integration.CacheWriter<? super K,? super V>>> cacheWriterFactory

      The `Factory` for the `CacheWriter`.

    - #### expiryPolicyFactory

          protected com.hazelcast.cache.impl.DeferredValue<javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy>> expiryPolicyFactory

      The `Factory` for the `ExpiryPolicy`.

    - #### isReadThrough

          protected boolean isReadThrough

      A flag indicating if "read-through" mode is required.

    - #### isWriteThrough

          protected boolean isWriteThrough

      A flag indicating if "write-through" mode is required.

    - #### isStatisticsEnabled

          protected boolean isStatisticsEnabled

      A flag indicating if statistics gathering is enabled.

    - #### isStoreByValue

          protected boolean isStoreByValue

      A flag indicating if the cache will be store-by-value or store-by-reference.

    - #### isManagementEnabled

          protected boolean isManagementEnabled

      Whether management is enabled

    - #### hotRestartConfig

          protected HotRestartConfig hotRestartConfig

    - #### classLoader

          protected transient ClassLoader classLoader

      The ClassLoader to be used to resolve key & value types, if set

    - #### serializationService

          protected transient com.hazelcast.internal.serialization.InternalSerializationService serializationService

    - #### listenerConfigurations

          protected Set<com.hazelcast.cache.impl.DeferredValue<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>>> listenerConfigurations

      The `CacheEntryListenerConfiguration`s for the `Configuration`.

  - ### Constructor Detail

    - #### AbstractCacheConfig

          public AbstractCacheConfig()

    - #### AbstractCacheConfig

          public AbstractCacheConfig(javax.cache.configuration.CompleteConfiguration<K,V> configuration)

  - ### Method Detail

    - #### addCacheEntryListenerConfiguration

          public CacheConfiguration<K,V> addCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)

      Add a configuration for a `CacheEntryListener`.
      Specified by:
        `addCacheEntryListenerConfiguration` in interface `CacheConfiguration<K,V>`
      Parameters:
        `cacheEntryListenerConfiguration` - the `CacheEntryListenerConfiguration`
      Returns:
        the `CacheConfig`
      Throws:
        `IllegalArgumentException` - if the same CacheEntryListenerConfiguration is used more than once

    - #### removeCacheEntryListenerConfiguration

          public CacheConfiguration<K,V> removeCacheEntryListenerConfiguration(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)

      Remove a configuration for a `CacheEntryListener`.
      Specified by:
        `removeCacheEntryListenerConfiguration` in interface `CacheConfiguration<K,V>`
      Parameters:
        `cacheEntryListenerConfiguration` - the `CacheEntryListenerConfiguration` to remove
      Returns:
        the `CacheConfig`

    - #### getCacheEntryListenerConfigurations

          public Iterable<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>> getCacheEntryListenerConfigurations()

      Specified by:
        `getCacheEntryListenerConfigurations` in interface `javax.cache.configuration.CompleteConfiguration<K,V>`

    - #### isReadThrough

          public boolean isReadThrough()

      Specified by:
        `isReadThrough` in interface `javax.cache.configuration.CompleteConfiguration<K,V>`

    - #### setReadThrough

          public CacheConfiguration<K,V> setReadThrough(boolean isReadThrough)

      Description copied from interface: `CacheConfiguration`
      Set if read-through caching should be used.

      It is an invalid configuration to set this to `true` without specifying a `CacheLoader` `Factory`.

      Specified by:
        `setReadThrough` in interface `CacheConfiguration<K,V>`
      Parameters:
        `isReadThrough` - `true` if read-through is required, `false` otherwise
      Returns:
        the `CacheConfiguration` to permit fluent-style method calls

    - #### isWriteThrough

          public boolean isWriteThrough()

      Specified by:
        `isWriteThrough` in interface `javax.cache.configuration.CompleteConfiguration<K,V>`

    - #### setWriteThrough

          public CacheConfiguration<K,V> setWriteThrough(boolean isWriteThrough)

      Description copied from interface: `CacheConfiguration`
      Set if write-through caching should be used.

      It is an invalid configuration to set this to `true` without specifying a `CacheWriter` `Factory`.

      Specified by:
        `setWriteThrough` in interface `CacheConfiguration<K,V>`
      Parameters:
        `isWriteThrough` - `true` if write-through is required, `false` otherwise
      Returns:
        the `CacheConfiguration` to permit fluent-style method calls

    - #### isStatisticsEnabled

          public boolean isStatisticsEnabled()

      Specified by:
        `isStatisticsEnabled` in interface `javax.cache.configuration.CompleteConfiguration<K,V>`

    - #### setStatisticsEnabled

          public CacheConfiguration<K,V> setStatisticsEnabled(boolean enabled)

      Sets whether or not statistics gathering is enabled on this cache.

      Statistics may be enabled or disabled at runtime via `CacheManager.enableStatistics(String, boolean)`.

      Specified by:
        `setStatisticsEnabled` in interface `CacheConfiguration<K,V>`
      Parameters:
        `enabled` - `true` to enable statistics, `false` to disable
      Returns:
        the `CacheConfig`

    - #### isManagementEnabled

          public boolean isManagementEnabled()

      Specified by:
        `isManagementEnabled` in interface `javax.cache.configuration.CompleteConfiguration<K,V>`

    - #### setManagementEnabled

          public CacheConfiguration<K,V> setManagementEnabled(boolean enabled)

      Sets whether or not management is enabled on this cache.

      Management may be enabled or disabled at runtime via `CacheManager.enableManagement(String, boolean)`.

      Specified by:
        `setManagementEnabled` in interface `CacheConfiguration<K,V>`
      Parameters:
        `enabled` - `true` to enable statistics, `false` to disable
      Returns:
        the `CacheConfig`

    - #### getHotRestartConfig

          public HotRestartConfig getHotRestartConfig()

      Gets the `HotRestartConfig` for this `CacheConfiguration`
      Returns:
        hot restart config

    - #### setHotRestartConfig

          public CacheConfiguration<K,V> setHotRestartConfig(HotRestartConfig hotRestartConfig)

      Sets the `HotRestartConfig` for this `CacheConfiguration`
      Parameters:
        `hotRestartConfig` - hot restart config
      Returns:
        this `CacheConfiguration` instance

    - #### getCacheLoaderFactory

          public javax.cache.configuration.Factory<javax.cache.integration.CacheLoader<K,V>> getCacheLoaderFactory()

      Specified by:
        `getCacheLoaderFactory` in interface `javax.cache.configuration.CompleteConfiguration<K,V>`

    - #### setCacheLoaderFactory

          public CacheConfiguration<K,V> setCacheLoaderFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheLoader<K,V>> cacheLoaderFactory)

      Description copied from interface: `CacheConfiguration`
      Set the `CacheLoader` factory.
      Specified by:
        `setCacheLoaderFactory` in interface `CacheConfiguration<K,V>`
      Parameters:
        `cacheLoaderFactory` - the `CacheLoader` `Factory`
      Returns:
        the `CacheConfiguration` to permit fluent-style method calls

    - #### setExpiryPolicyFactory

          public CacheConfiguration<K,V> setExpiryPolicyFactory(javax.cache.configuration.Factory<? extends javax.cache.expiry.ExpiryPolicy> expiryPolicyFactory)

      Description copied from interface: `CacheConfiguration`
      Set the `Factory` for the `ExpiryPolicy`. If `null` is specified the default `ExpiryPolicy` is used.
      Specified by:
        `setExpiryPolicyFactory` in interface `CacheConfiguration<K,V>`
      Parameters:
        `expiryPolicyFactory` - the `ExpiryPolicy` `Factory`
      Returns:
        the `CacheConfiguration` to permit fluent-style method calls

    - #### setCacheWriterFactory

          public CacheConfiguration<K,V> setCacheWriterFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheWriter<? super K,? super V>> cacheWriterFactory)

      Description copied from interface: `CacheConfiguration`
      Set the `CacheWriter` factory.
      Specified by:
        `setCacheWriterFactory` in interface `CacheConfiguration<K,V>`
      Parameters:
        `cacheWriterFactory` - the `CacheWriter` `Factory`
      Returns:
        the `CacheConfiguration` to permit fluent-style method calls

    - #### getCacheWriterFactory

          public javax.cache.configuration.Factory<javax.cache.integration.CacheWriter<? super K,? super V>> getCacheWriterFactory()

      Specified by:
        `getCacheWriterFactory` in interface `javax.cache.configuration.CompleteConfiguration<K,V>`

    - #### getExpiryPolicyFactory

          public javax.cache.configuration.Factory<javax.cache.expiry.ExpiryPolicy> getExpiryPolicyFactory()

      Specified by:
        `getExpiryPolicyFactory` in interface `javax.cache.configuration.CompleteConfiguration<K,V>`

    - #### getKeyType

          public Class<K> getKeyType()

      Specified by:
        `getKeyType` in interface `javax.cache.configuration.Configuration<K,V>`

    - #### getKeyClassName

          public String getKeyClassName()

    - #### setKeyClassName

          public CacheConfiguration<K,V> setKeyClassName(String keyClassName)

    - #### getValueType

          public Class<V> getValueType()

      Specified by:
        `getValueType` in interface `javax.cache.configuration.Configuration<K,V>`

    - #### getValueClassName

          public String getValueClassName()

    - #### setValueClassName

          public CacheConfiguration<K,V> setValueClassName(String valueClassName)

    - #### setTypes

          public CacheConfiguration<K,V> setTypes(Class<K> keyType,
                                                  Class<V> valueType)

      Sets the expected type of keys and values for a `Cache` configured with this `Configuration`. Setting both to `Object.class` means type-safety checks are not required.

      This is used by `CacheManager` to ensure that the key and value types are the same as those configured for the `Cache` prior to returning a requested cache from this method.

      Implementations may further perform type checking on mutative cache operations and throw a `ClassCastException` if these checks fail.

      Specified by:
        `setTypes` in interface `CacheConfiguration<K,V>`
      Parameters:
        `keyType` - the expected key type
        `valueType` - the expected value type
      Returns:
        the `CacheConfig`
      Throws:
        `NullPointerException` - should the key or value type be null
      See Also:
        `CacheManager.getCache(String, Class, Class)`

    - #### isStoreByValue

          public boolean isStoreByValue()

      Specified by:
        `isStoreByValue` in interface `javax.cache.configuration.Configuration<K,V>`

    - #### setStoreByValue

          public CacheConfiguration<K,V> setStoreByValue(boolean storeByValue)

      Set if a configured cache should use store-by-value or store-by-reference semantics.
      Specified by:
        `setStoreByValue` in interface `CacheConfiguration<K,V>`
      Parameters:
        `storeByValue` - `true` if store-by-value is required, `false` for store-by-reference
      Returns:
        the `CacheConfig`

    - #### createConcurrentSet

          protected Set<com.hazelcast.cache.impl.DeferredValue<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>>> createConcurrentSet()

    - #### setKeyType

          public CacheConfiguration<K,V> setKeyType(Class<K> keyType)

    - #### setValueType

          public CacheConfiguration<K,V> setValueType(Class<V> valueType)

    - #### setListenerConfigurations

          public CacheConfiguration<K,V> setListenerConfigurations()

    - #### setListenerConfigurations

          protected CacheConfiguration<K,V> setListenerConfigurations(Set<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>> listeners)

    - #### getListenerConfigurations

          public Set<javax.cache.configuration.CacheEntryListenerConfiguration<K,V>> getListenerConfigurations()

    - #### hasListenerConfiguration

          protected boolean hasListenerConfiguration()

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### setClassLoader

          protected void setClassLoader(ClassLoader classLoader)

    - #### keyValueTypesEqual

          protected boolean keyValueTypesEqual(AbstractCacheConfig that)

Copyright © 2018. All rights reserved.