org.apache.solr.client.solrj.cloud.autoscaling

## Class Policy

- java.lang.Object
- - org.apache.solr.client.solrj.cloud.autoscaling.Policy

All Implemented Interfaces:
  MapSerializable, MapWriter, NavigableObject

    public class Policy
    extends Object
    implements MapWriter

### Nested Class Summary

Nested Classes
`static class` `Policy.Session`
`static class` `Policy.SortParam`

### Nested classes/interfaces inherited from interface org.apache.solr.common.MapWriter

`MapWriter.EntryWriter`

### Field Summary

Fields
`static String` `ANY`
`static String` `CLUSTER_POLICY`
`static String` `CLUSTER_PREFERENCES`
`static List<Preference>` `DEFAULT_PREFERENCES`
`static String` `EACH`
`static Set<String>` `GLOBAL_ONLY_TAGS`
`static String` `POLICIES`
`static String` `POLICY`

### Constructor Summary

Constructors
Constructor and Description
`Policy()`
`Policy(Map<String,Object> jsonMap)`
`Policy(Map<String,Object> jsonMap, int version)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static Map<String,List<Clause>>` `clausesFromMap(Map<String,List<Map<String,Object>>> map, List<String> newParams)`
`Policy.Session` `createSession(SolrCloudManager cloudManager)`
`Policy.Session` `createSession(SolrCloudManager cloudManager, org.apache.solr.client.solrj.cloud.autoscaling.Policy.Transaction tx)`
`boolean` `equals(Object o)`
`List<Clause>` `getClusterPolicy()`
`List<Preference>` `getClusterPreferences()`
`List<String>` `getParamNames()`
`List<Pair<String,Variable.Type>>` `getParams()`
`List<String>` `getPerReplicaAttributes()`
`Map<String,List<Clause>>` `getPolicies()`
`int` `getZkVersion()`
`int` `hashCode()`
`boolean` `isEmpty()`
`boolean` `isEmptyPreferences()`
`static List<Clause>` `mergePolicies(String coll, List<Clause> collPolicy, List<Clause> globalPolicy)`
`String` `toString()`
`Policy` `withClusterPolicy(List<Clause> clusterPolicy)`
`Policy` `withClusterPreferences(List<Preference> clusterPreferences)`
`Policy` `withParams(List<String> params)`
`Policy` `withPolicies(Map<String,List<Clause>> policies)`
`void` `writeMap(MapWriter.EntryWriter ew)`

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

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

### Methods inherited from interface org.apache.solr.common.MapWriter

`jsonStr, toMap`

### Methods inherited from interface org.apache.solr.common.NavigableObject

`_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr`

### Field Detail

#### POLICY

    public static final String POLICY

See Also:
  Constant Field Values

#### EACH

    public static final String EACH

See Also:
  Constant Field Values

#### ANY

    public static final String ANY

See Also:
  Constant Field Values

#### POLICIES

    public static final String POLICIES

See Also:
  Constant Field Values

#### CLUSTER_POLICY

    public static final String CLUSTER_POLICY

See Also:
  Constant Field Values

#### CLUSTER_PREFERENCES

    public static final String CLUSTER_PREFERENCES

See Also:
  Constant Field Values

#### GLOBAL_ONLY_TAGS

    public static final Set<String> GLOBAL_ONLY_TAGS

#### DEFAULT_PREFERENCES

    public static final List<Preference> DEFAULT_PREFERENCES

### Constructor Detail

#### Policy

    public Policy()

#### Policy

    public Policy(Map<String,Object> jsonMap)

#### Policy

    public Policy(Map<String,Object> jsonMap,
                  int version)

### Method Detail

#### withPolicies

    public Policy withPolicies(Map<String,List<Clause>> policies)

#### withClusterPreferences

    public Policy withClusterPreferences(List<Preference> clusterPreferences)

#### withClusterPolicy

    public Policy withClusterPolicy(List<Clause> clusterPolicy)

#### withParams

    public Policy withParams(List<String> params)

#### getClusterPolicy

    public List<Clause> getClusterPolicy()

#### getClusterPreferences

    public List<Preference> getClusterPreferences()

#### writeMap

    public void writeMap(MapWriter.EntryWriter ew)
                  throws IOException

Specified by:
  `writeMap` in interface `MapWriter`
Throws:
  `IOException`

#### equals

    public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### clausesFromMap

    public static Map<String,List<Clause>> clausesFromMap(Map<String,List<Map<String,Object>>> map,
                                                          List<String> newParams)

#### createSession

    public Policy.Session createSession(SolrCloudManager cloudManager)

#### createSession

    public Policy.Session createSession(SolrCloudManager cloudManager,
                                        org.apache.solr.client.solrj.cloud.autoscaling.Policy.Transaction tx)

#### mergePolicies

    public static List<Clause> mergePolicies(String coll,
                                             List<Clause> collPolicy,
                                             List<Clause> globalPolicy)

#### getPolicies

    public Map<String,List<Clause>> getPolicies()

#### getParams

    public List<Pair<String,Variable.Type>> getParams()

#### getParamNames

    public List<String> getParamNames()

#### getPerReplicaAttributes

    public List<String> getPerReplicaAttributes()

#### getZkVersion

    public int getZkVersion()

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### isEmpty

    public boolean isEmpty()

#### isEmptyPreferences

    public boolean isEmptyPreferences()

Returns:
  true if no preferences were specified by the user, false otherwise