org.apache.ignite.internal.processors.cache

## Class CacheDefaultBinaryAffinityKeyMapper

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper
  - - org.apache.ignite.internal.processors.cache.CacheDefaultBinaryAffinityKeyMapper

All Implemented Interfaces:
  Serializable, AffinityKeyMapper

    public class CacheDefaultBinaryAffinityKeyMapper
    extends GridCacheDefaultAffinityKeyMapper

See Also:
  Serialized Form

### Field Summary

### Fields inherited from class org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper

`ignite, log`

### Constructor Summary

Constructors
Constructor and Description
`CacheDefaultBinaryAffinityKeyMapper(@Nullable CacheKeyConfiguration[] cacheKeyCfgs)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`Object` `affinityKey(Object key)` If key class has annotation `AffinityKeyMapped`, then the value of annotated method or field will be used to get affinity value instead of the key itself.
`@Nullable BinaryField` `affinityKeyField(int typeId)` Get affinity field override for type.
`@Nullable BinaryField` `affinityKeyField(String typeName)` Get affinity field override for type.
`void` `ignite(Ignite ignite)`

### Methods inherited from class org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper

`affinityKeyPropertyName, reset`

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

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

### Constructor Detail

#### CacheDefaultBinaryAffinityKeyMapper

    public CacheDefaultBinaryAffinityKeyMapper(@Nullable
                                               @Nullable CacheKeyConfiguration[] cacheKeyCfgs)

Constructor.

Parameters:
  `cacheKeyCfgs` - Cache key configurations.

### Method Detail

#### affinityKey

    public Object affinityKey(Object key)

If key class has annotation `AffinityKeyMapped`, then the value of annotated method or field will be used to get affinity value instead of the key itself. If there is no annotation, then the key is returned as is.

Specified by:
  `affinityKey` in interface `AffinityKeyMapper`
Overrides:
  `affinityKey` in class `GridCacheDefaultAffinityKeyMapper`
Parameters:
  `key` - Key to get affinity key for.
Returns:
  Affinity key for given key.

#### affinityKeyField

    @Nullable
    public @Nullable BinaryField affinityKeyField(String typeName)

Get affinity field override for type.

Parameters:
  `typeName` - Type name.
Returns:
  Affinity field override if any.

#### affinityKeyField

    @Nullable
    public @Nullable BinaryField affinityKeyField(int typeId)

Get affinity field override for type.

Parameters:
  `typeId` - Type ID.
Returns:
  Affinity field override if any.

#### ignite

    public void ignite(Ignite ignite)

Overrides:
  `ignite` in class `GridCacheDefaultAffinityKeyMapper`
Parameters:
  `ignite` - Ignite.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.8.0
Release Date | : February 27 2020