org.apache.geode.cache

## Interface AttributesMutator<K,V>

-     public interface AttributesMutator<K,V>

  Supports modification of certain region attributes after the region has been created. It is recommended that the attributes be completely initialized using an `AttributesFactory` before creating the region instead of using an `AttributesMutator` after region creation. This will avoid a potential performance penalty due to the additional network traffic.

  The setter methods all return the previous value of the attribute.

  Since:
    GemFire 3.0
  See Also:
    `Region.getAttributesMutator()`, `RegionAttributes`, `AttributesFactory`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAsyncEventQueueId(java.lang.String asyncEventQueueId)` Adds AsyncEventQueueId to the list of AsyncEventQueueId of the region.
    `void` | `addCacheListener(CacheListener<K,V> aListener)` Adds a cache listener to the end of the list of cache listeners on this region.
    `void` | `addGatewaySenderId(java.lang.String gatewaySenderId)` Adds GatewaySenderId to the list of GatewaySenderIds of the region.
    `boolean` | `getCloningEnabled()` Returns whether or not cloning is enabled on region
    `EvictionAttributesMutator` | `getEvictionAttributesMutator()` Allows changing the eviction controller attributes for the region.
    `Region<K,V>` | `getRegion()` Returns the Region whose attributes this mutator affects.
    `void` | `initCacheListeners(CacheListener<K,V>[] newListeners)` Removes all cache listeners, calling `CacheCallback.close()` on each of them, and then adds each listener in the specified array.
    `void` | `removeAsyncEventQueueId(java.lang.String asyncEventQueueId)` Removes AsyncEventQueueId from the list of AsyncEventQueuesId of the region.
    `void` | `removeCacheListener(CacheListener<K,V> aListener)` Removes a cache listener from the list of cache listeners on this region.
    `void` | `removeGatewaySenderId(java.lang.String gatewaySenderId)` Removes GatewaySenderId from the list of GatewaySenderIds of the region.
    `CacheLoader<K,V>` | `setCacheLoader(CacheLoader<K,V> cacheLoader)` Changes the cache loader for the region.
    `CacheWriter<K,V>` | `setCacheWriter(CacheWriter<K,V> cacheWriter)` Changes the cache writer for the region.
    `void` | `setCloningEnabled(boolean cloningEnable)` Sets cloning on region Note: off-heap regions always behave as if cloning is enabled.
    `CustomExpiry<K,V>` | `setCustomEntryIdleTimeout(CustomExpiry<K,V> custom)` Changes the CustomExpiry for idleTimeout for values in the region
    `CustomExpiry<K,V>` | `setCustomEntryTimeToLive(CustomExpiry<K,V> custom)` Changes the custom timeToLive for values in this region
    `ExpirationAttributes` | `setEntryIdleTimeout(ExpirationAttributes idleTimeout)` Changes the idleTimeout expiration attributes for values in the region.
    `ExpirationAttributes` | `setEntryTimeToLive(ExpirationAttributes timeToLive)` Changes the timeToLive expiration attributes for values in this region.
    `ExpirationAttributes` | `setRegionIdleTimeout(ExpirationAttributes idleTimeout)` Changes the idleTimeout expiration attributes for the region as a whole.
    `ExpirationAttributes` | `setRegionTimeToLive(ExpirationAttributes timeToLive)` Changes the timeToLive expiration attributes for the region as a whole

- - ### Method Detail

    - #### getRegion

          Region<K,V> getRegion()

      Returns the Region whose attributes this mutator affects.
      Returns:
        the Region this mutator affects

    - #### setRegionTimeToLive

          ExpirationAttributes setRegionTimeToLive(ExpirationAttributes timeToLive)

      Changes the timeToLive expiration attributes for the region as a whole
      Parameters:
        `timeToLive` - the expiration attributes for the region timeToLive
      Returns:
        the previous value of region timeToLive
      Throws:
        `java.lang.IllegalArgumentException` - if timeToLive is null or if the ExpirationAction is LOCAL_INVALIDATE and the region is `replicated`
        `java.lang.IllegalStateException` - if statistics are disabled for this region.

    - #### setRegionIdleTimeout

          ExpirationAttributes setRegionIdleTimeout(ExpirationAttributes idleTimeout)

      Changes the idleTimeout expiration attributes for the region as a whole. Resets the `CacheStatistics.getLastAccessedTime()` for the region.
      Parameters:
        `idleTimeout` - the ExpirationAttributes for this region idleTimeout
      Returns:
        the previous value of region idleTimeout
      Throws:
        `java.lang.IllegalArgumentException` - if idleTimeout is null or if the ExpirationAction is LOCAL_INVALIDATE and the region is `replicated`
        `java.lang.IllegalStateException` - if statistics are disabled for this region.

    - #### setEntryTimeToLive

          ExpirationAttributes setEntryTimeToLive(ExpirationAttributes timeToLive)

      Changes the timeToLive expiration attributes for values in this region.
      Parameters:
        `timeToLive` - the timeToLive expiration attributes for entries
      Returns:
        the previous value of entry timeToLive
      Throws:
        `java.lang.IllegalArgumentException` - if timeToLive is null or if the ExpirationAction is LOCAL_DESTROY and the region is `replicated` or if the ExpirationAction is LOCAL_INVALIDATE and the region is `replicated`
        `java.lang.IllegalStateException` - if statistics are disabled for this region.

    - #### setCustomEntryTimeToLive

          CustomExpiry<K,V> setCustomEntryTimeToLive(CustomExpiry<K,V> custom)

      Changes the custom timeToLive for values in this region
      Parameters:
        `custom` - the new CustomExpiry
      Returns:
        the old CustomExpiry

    - #### setEntryIdleTimeout

          ExpirationAttributes setEntryIdleTimeout(ExpirationAttributes idleTimeout)

      Changes the idleTimeout expiration attributes for values in the region.
      Parameters:
        `idleTimeout` - the idleTimeout expiration attributes for entries
      Returns:
        the previous value of entry idleTimeout
      Throws:
        `java.lang.IllegalArgumentException` - if idleTimeout is null or if the ExpirationAction is LOCAL_DESTROY and the region is `replicated` or if the the ExpirationAction is LOCAL_INVALIDATE and the region is `replicated`
        `java.lang.IllegalStateException` - if statistics are disabled for this region.
      See Also:
        `AttributesFactory.setStatisticsEnabled(boolean)`

    - #### setCustomEntryIdleTimeout

          CustomExpiry<K,V> setCustomEntryIdleTimeout(CustomExpiry<K,V> custom)

      Changes the CustomExpiry for idleTimeout for values in the region
      Parameters:
        `custom` - the new CustomExpiry
      Returns:
        the old CustomExpiry

    - #### addCacheListener

          void addCacheListener(CacheListener<K,V> aListener)

      Adds a cache listener to the end of the list of cache listeners on this region.
      Parameters:
        `aListener` - the user defined cache listener to add to the region.
      Throws:
        `java.lang.IllegalArgumentException` - if `aListener` is null
      Since:
        GemFire 5.0

    - #### removeCacheListener

          void removeCacheListener(CacheListener<K,V> aListener)

      Removes a cache listener from the list of cache listeners on this region. Does nothing if the specified listener has not been added. If the specified listener has been added then `CacheCallback.close()` will be called on it; otherwise does nothing.
      Parameters:
        `aListener` - the cache listener to remove from the region.
      Throws:
        `java.lang.IllegalArgumentException` - if `aListener` is null
      Since:
        GemFire 5.0

    - #### initCacheListeners

          void initCacheListeners(CacheListener<K,V>[] newListeners)

      Removes all cache listeners, calling `CacheCallback.close()` on each of them, and then adds each listener in the specified array.
      Parameters:
        `newListeners` - a possibly null or empty array of listeners to add to this region.
      Throws:
        `java.lang.IllegalArgumentException` - if the `newListeners` array has a null element
      Since:
        GemFire 5.0

    - #### setCacheWriter

          CacheWriter<K,V> setCacheWriter(CacheWriter<K,V> cacheWriter)

      Changes the cache writer for the region.
      Parameters:
        `cacheWriter` - the cache writer
      Returns:
        the previous CacheWriter

    - #### setCacheLoader

          CacheLoader<K,V> setCacheLoader(CacheLoader<K,V> cacheLoader)

      Changes the cache loader for the region. Changing the cache loader for partitioned regions is not recommended due to the fact that it can result in an inconsistent cache loader configuration. This feature may be removed in future releases.
      Parameters:
        `cacheLoader` - the cache loader
      Returns:
        the previous CacheLoader

    - #### getEvictionAttributesMutator

          EvictionAttributesMutator getEvictionAttributesMutator()

      Allows changing the eviction controller attributes for the region.
      Returns:
        the `EvictionAttributesMutator` used to change the EvictionAttributes

    - #### setCloningEnabled

          void setCloningEnabled(boolean cloningEnable)

      Sets cloning on region Note: off-heap regions always behave as if cloning is enabled.
      Parameters:
        `cloningEnable` -
      Since:
        GemFire 6.1

    - #### getCloningEnabled

          boolean getCloningEnabled()

      Returns whether or not cloning is enabled on region
      Returns:
        True if cloning is enabled (default); false cloning is not enabled.
      Since:
        GemFire 6.1

    - #### addGatewaySenderId

          void addGatewaySenderId(java.lang.String gatewaySenderId)

      Adds GatewaySenderId to the list of GatewaySenderIds of the region. If the GatewaySenderId is not present on this VM then it will try to send it to other VM's
      Parameters:
        `gatewaySenderId` -

    - #### removeGatewaySenderId

          void removeGatewaySenderId(java.lang.String gatewaySenderId)

      Removes GatewaySenderId from the list of GatewaySenderIds of the region.
      Parameters:
        `gatewaySenderId` -

    - #### addAsyncEventQueueId

          void addAsyncEventQueueId(java.lang.String asyncEventQueueId)

      Adds AsyncEventQueueId to the list of AsyncEventQueueId of the region.
      Parameters:
        `asyncEventQueueId` -

    - #### removeAsyncEventQueueId

          void removeAsyncEventQueueId(java.lang.String asyncEventQueueId)

      Removes AsyncEventQueueId from the list of AsyncEventQueuesId of the region.
      Parameters:
        `asyncEventQueueId` -