org.apache.solr.client.solrj.routing

## Class AffinityReplicaListTransformer

- java.lang.Object
- - org.apache.solr.client.solrj.routing.AffinityReplicaListTransformer

All Implemented Interfaces:
  ReplicaListTransformer

    public class AffinityReplicaListTransformer
    extends Object
    implements ReplicaListTransformer

Allows better caching by establishing deterministic evenly-distributed replica routing preferences according to either explicitly configured hash routing parameter, or the hash of a query parameter (configurable, usually related to the main query).

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static ReplicaListTransformer` `getInstance(String dividendParam, String hashParam, SolrParams requestParams)`
`void` `transform(List<?> choices)` Transforms the passed in list of choices.

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

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

### Method Detail

#### getInstance

    public static ReplicaListTransformer getInstance(String dividendParam,
                                                     String hashParam,
                                                     SolrParams requestParams)

Parameters:
  `dividendParam` - int param to be used directly for mod-based routing
  `hashParam` - String param to be hashed into an int for mod-based routing
  `requestParams` - the parameters of the Solr request
Returns:
  null if specified routing vals are not able to be parsed properly

#### transform

    public void transform(List<?> choices)

Description copied from interface: `ReplicaListTransformer`
Transforms the passed in list of choices. Transformations can include (but are not limited to) reordering of elements (e.g. via shuffling) and removal of elements (i.e. filtering).

Specified by:
  `transform` in interface `ReplicaListTransformer`
Parameters:
  `choices` - - a list of choices to transform, typically the choices are `Replica` objects but choices can also be `String` objects such as URLs passed in via the `ShardParams.SHARDS` parameter.