com.hazelcast.client.proxy.txn

## Class ClientTxnMapProxy<K,V>

- java.lang.Object
- - com.hazelcast.client.proxy.txn.ClientTxnMapProxy<K,V>

- Type Parameters:
    `K` - key
    `V` - value
  All Implemented Interfaces:
    BaseMap<K,V>, DistributedObject, TransactionalMap<K,V>, TransactionalObject

      public class ClientTxnMapProxy<K,V>
      extends Object
      implements TransactionalMap<K,V>

  Proxy implementation of `TransactionalMap` interface.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientTxnMapProxy(String name, ClientTransactionContext transactionContext)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `containsKey(Object key)` Transactional implementation of `IMap.containsKey(Object)`.
    `void` | `delete(Object key)` Transactional implementation of `IMap.delete(Object)`.
    `void` | `destroy()` Destroys this object cluster-wide.
    `V` | `get(Object key)` Transactional implementation of `IMap.get(Object)`.
    `V` | `getForUpdate(Object key)` Locks the key and then gets and returns the value to which the specified key is mapped.
    `String` | `getName()` Returns the unique name for this DistributedObject.
    `String` | `getPartitionKey()` Returns the key of the partition that this DistributedObject is assigned to.
    `String` | `getServiceName()` Returns the service name for this object.
    `boolean` | `isEmpty()` Transactional implementation of `Map.isEmpty()`.
    `Set<K>` | `keySet()` Transactional implementation of `IMap.keySet()`.
    `Set<K>` | `keySet(Predicate predicate)` Transactional implementation of `IMap.keySet(com.hazelcast.query.Predicate)`.
    `V` | `put(K key, V value)` Transactional implementation of `IMap.put(Object, Object)`.
    `V` | `put(K key, V value, long ttl, TimeUnit timeunit)` Transactional implementation of `IMap.put(Object, Object, long, TimeUnit)`.
    `V` | `putIfAbsent(K key, V value)` Transactional implementation of `IMap.putIfAbsent(Object, Object)`.
    `V` | `remove(Object key)` Transactional implementation of `IMap.remove(Object)`.
    `boolean` | `remove(Object key, Object value)` Transactional implementation of `IMap.remove(Object, Object)`.
    `V` | `replace(K key, V value)` Transactional implementation of `IMap.replace(Object, Object)`.
    `boolean` | `replace(K key, V oldValue, V newValue)` Transactional implementation of `IMap.replace(Object, Object, Object)`.
    `void` | `set(K key, V value)` Transactional implementation of `IMap.set(Object, Object)`.
    `int` | `size()` Transactional implementation of `Map.size()`.
    `Collection<V>` | `values()` Transactional implementation of `IMap.values()`.
    `Collection<V>` | `values(Predicate predicate)` Transactional implementation of `IMap.values(com.hazelcast.query.Predicate)`.

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

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

    - ### Methods inherited from interface com.hazelcast.core.DistributedObject

      `destroy, getName, getPartitionKey`

- - ### Constructor Detail

    - #### ClientTxnMapProxy

          public ClientTxnMapProxy(String name,
                                   ClientTransactionContext transactionContext)

  - ### Method Detail

    - #### containsKey

          public boolean containsKey(Object key)

      Description copied from interface: `TransactionalMap`
      Transactional implementation of `IMap.containsKey(Object)`.
      Specified by:
        `containsKey` in interface `BaseMap<K,V>`
      Specified by:
        `containsKey` in interface `TransactionalMap<K,V>`
      Parameters:
        `key` - The specified key.
      Returns:
        `true` if this map contains an entry for the specified key.
      See Also:
        `IMap.containsKey(Object)`

    - #### get

          public V get(Object key)

      Description copied from interface: `TransactionalMap`
      Transactional implementation of `IMap.get(Object)`.
      Specified by:
        `get` in interface `BaseMap<K,V>`
      Specified by:
        `get` in interface `TransactionalMap<K,V>`
      Parameters:
        `key` - The specified key.
      Returns:
        The value for the specified key.
      See Also:
        `IMap.get(Object)`

    - #### getForUpdate

          public V getForUpdate(Object key)

      Description copied from interface: `TransactionalMap`
      Locks the key and then gets and returns the value to which the specified key is mapped. The lock will be released at the end of the transaction (either commit or rollback).
      Specified by:
        `getForUpdate` in interface `TransactionalMap<K,V>`
      See Also:
        `IMap.get(Object)`

    - #### size

          public int size()

      Description copied from interface: `TransactionalMap`
      Transactional implementation of `Map.size()`.
      Specified by:
        `size` in interface `BaseMap<K,V>`
      Specified by:
        `size` in interface `TransactionalMap<K,V>`
      Returns:
        the number of entries in this map.
      See Also:
        `Map.size()`

    - #### isEmpty

          public boolean isEmpty()

      Description copied from interface: `TransactionalMap`
      Transactional implementation of `Map.isEmpty()`.
      Specified by:
        `isEmpty` in interface `BaseMap<K,V>`
      Specified by:
        `isEmpty` in interface `TransactionalMap<K,V>`
      Returns:
        `true` if this map contains no entries.
      See Also:
        `Map.isEmpty()`

    - #### put

          public V put(K key,
                       V value)

      Description copied from interface: `TransactionalMap`
      Transactional implementation of `IMap.put(Object, Object)`.

      The object to be put will be accessible only in the current transaction context till transaction is committed.

      Specified by:
        `put` in interface `BaseMap<K,V>`
      Specified by:
        `put` in interface `TransactionalMap<K,V>`
      Parameters:
        `key` - The specified key.
        `value` - The value to associate with the key.
      Returns:
        Previous value associated with `key` or `null` if there was no mapping for `key`.
      See Also:
        `IMap.put(Object, Object)`

    - #### put

          public V put(K key,
                       V value,
                       long ttl,
                       TimeUnit timeunit)

      Description copied from interface: `TransactionalMap`
      Transactional implementation of `IMap.put(Object, Object, long, TimeUnit)`.

      The object to be put will be accessible only in the current transaction context till transaction is committed.

      Specified by:
        `put` in interface `BaseMap<K,V>`
      Specified by:
        `put` in interface `TransactionalMap<K,V>`
      Parameters:
        `key` - The specified key.
        `value` - The value to associate with the key.
        `ttl` - maximum time for this entry to stay in the map 0 means infinite.
        `timeunit` - time unit for the ttl
      Returns:
        Previous value associated with `key` or `null` if there was no mapping for `key`.
      See Also:
        `IMap.put(Object, Object, long, TimeUnit)`

    - #### set

          public void set(K key,
                          V value)

      Description copied from interface: `TransactionalMap`
      Transactional implementation of `IMap.set(Object, Object)`.

      The object to be set will be accessible only in the current transaction context till transaction is committed.

      Specified by:
        `set` in interface `BaseMap<K,V>`
      Specified by:
        `set` in interface `TransactionalMap<K,V>`
      Parameters:
        `key` - The specified key.
        `value` - The value to associate with the key.
      See Also:
        `IMap.set(Object, Object)`

    - #### putIfAbsent

          public V putIfAbsent(K key,
                               V value)

      Description copied from interface: `TransactionalMap`
      Transactional implementation of `IMap.putIfAbsent(Object, Object)`.

      The object to be put will be accessible only in the current transaction context until the transaction is committed.

      Specified by:
        `putIfAbsent` in interface `BaseMap<K,V>`
      Specified by:
        `putIfAbsent` in interface `TransactionalMap<K,V>`
      Parameters:
        `key` - The specified key.
        `value` - The value to associate with the key when there is no previous value.
      Returns:
        The previous value associated with `key`, or `null` if there was no mapping for `key`.
      See Also:
        `IMap.putIfAbsent(Object, Object)`

    - #### replace

          public V replace(K key,
                           V value)

      Description copied from interface: `TransactionalMap`
      Transactional implementation of `IMap.replace(Object, Object)`.

      The object to be replaced will be accessible only in the current transaction context until the transaction is committed.

      Specified by:
        `replace` in interface `BaseMap<K,V>`
      Specified by:
        `replace` in interface `TransactionalMap<K,V>`
      Parameters:
        `key` - The specified key.
        `value` - The value to replace the previous value.
      Returns:
        The previous value associated with `key`, or `null` if there was no mapping for `key`.
      See Also:
        `IMap.replace(Object, Object)`

    - #### replace

          public boolean replace(K key,
                                 V oldValue,
                                 V newValue)

      Description copied from interface: `TransactionalMap`
      Transactional implementation of `IMap.replace(Object, Object, Object)`.

      The object to be replaced will be accessible only in the current transaction context until the transaction is committed.

      Specified by:
        `replace` in interface `BaseMap<K,V>`
      Specified by:
        `replace` in interface `TransactionalMap<K,V>`
      Parameters:
        `key` - The specified key.
        `oldValue` - Replace the key value if it is the old value.
        `newValue` - The new value to replace the old value.
      Returns:
        `true` if the value was replaced.
      See Also:
        `IMap.replace(Object, Object, Object)`

    - #### remove

          public V remove(Object key)

      Description copied from interface: `TransactionalMap`
      Transactional implementation of `IMap.remove(Object)`.

      The object to be removed will be removed from only the current transaction context until the transaction is committed.

      Specified by:
        `remove` in interface `BaseMap<K,V>`
      Specified by:
        `remove` in interface `TransactionalMap<K,V>`
      Parameters:
        `key` - Remove the mapping for this key.
      Returns:
        The previous value associated with `key`, or `null` if there was no mapping for `key`.
      See Also:
        `IMap.remove(Object)`

    - #### delete

          public void delete(Object key)

      Description copied from interface: `TransactionalMap`
      Transactional implementation of `IMap.delete(Object)`.

      The object to be deleted will be removed from only the current transaction context until the transaction is committed.

      Specified by:
        `delete` in interface `BaseMap<K,V>`
      Specified by:
        `delete` in interface `TransactionalMap<K,V>`
      Parameters:
        `key` - Remove the mapping for this key.
      See Also:
        `IMap.delete(Object)`

    - #### remove

          public boolean remove(Object key,
                                Object value)

      Description copied from interface: `TransactionalMap`
      Transactional implementation of `IMap.remove(Object, Object)`.

      The object to be removed will be removed from only the current transaction context until the transaction is committed.

      Specified by:
        `remove` in interface `BaseMap<K,V>`
      Specified by:
        `remove` in interface `TransactionalMap<K,V>`
      Parameters:
        `key` - The specified key.
        `value` - Remove the key if it has this value.
      Returns:
        `true` if the value was removed.
      See Also:
        `IMap.remove(Object, Object)`

    - #### keySet

          public Set<K> keySet()

      Description copied from interface: `TransactionalMap`
      Transactional implementation of `IMap.keySet()`.
      Specified by:
        `keySet` in interface `BaseMap<K,V>`
      Specified by:
        `keySet` in interface `TransactionalMap<K,V>`
      Returns:
        a set clone of the keys contained in this map.
      See Also:
        `IMap.keySet()`

    - #### keySet

          public Set<K> keySet(Predicate predicate)

      Description copied from interface: `TransactionalMap`
      Transactional implementation of `IMap.keySet(com.hazelcast.query.Predicate)`.
      Specified by:
        `keySet` in interface `BaseMap<K,V>`
      Specified by:
        `keySet` in interface `TransactionalMap<K,V>`
      Parameters:
        `predicate` - specified query criteria.
      Returns:
        result key set of the query.
      See Also:
        `IMap.keySet(com.hazelcast.query.Predicate)`

    - #### values

          public Collection<V> values()

      Description copied from interface: `TransactionalMap`
      Transactional implementation of `IMap.values()`.
      Specified by:
        `values` in interface `BaseMap<K,V>`
      Specified by:
        `values` in interface `TransactionalMap<K,V>`
      Returns:
        a collection clone of the values contained in this map
      See Also:
        `IMap.values()`

    - #### values

          public Collection<V> values(Predicate predicate)

      Description copied from interface: `TransactionalMap`
      Transactional implementation of `IMap.values(com.hazelcast.query.Predicate)`.
      Specified by:
        `values` in interface `BaseMap<K,V>`
      Specified by:
        `values` in interface `TransactionalMap<K,V>`
      Parameters:
        `predicate` - specified query criteria.
      Returns:
        result value collection of the query.
      See Also:
        `IMap.values(com.hazelcast.query.Predicate)`

    - #### getServiceName

          public String getServiceName()

      Description copied from interface: `DistributedObject`
      Returns the service name for this object.
      Specified by:
        `getServiceName` in interface `DistributedObject`
      Returns:
        the service name for this object.

    - #### getName

          public String getName()

      Description copied from interface: `DistributedObject`
      Returns the unique name for this DistributedObject. The returned value will never be null. The suggested way for getting name is retrieving it through `DistributedObjectUtil.getName(DistributedObject)` because this might be also a `PrefixedDistributedObject`.
      Specified by:
        `getName` in interface `DistributedObject`
      Returns:
        the unique name for this object.

    - #### getPartitionKey

          public String getPartitionKey()

      Description copied from interface: `DistributedObject`
      Returns the key of the partition that this DistributedObject is assigned to. The returned value only has meaning for a non-partitioned data structure like an `IAtomicLong`. For a partitioned data structure like an `IMap`, the returned value will not be null, but otherwise undefined.
      Specified by:
        `getPartitionKey` in interface `DistributedObject`
      Returns:
        the partition key.

    - #### destroy

          public final void destroy()

      Description copied from interface: `DistributedObject`
      Destroys this object cluster-wide. Clears and releases all resources for this object.
      Specified by:
        `destroy` in interface `DistributedObject`

Copyright © 2019. All rights reserved.