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

## Class AutoScalingConfig

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

All Implemented Interfaces:
  MapSerializable, MapWriter, NavigableObject

    public class AutoScalingConfig
    extends Object
    implements MapWriter

Bean representation of `autoscaling.json`, which parses data lazily.

### Nested Class Summary

Nested Classes
`static class` `AutoScalingConfig.ActionConfig` Bean representation of trigger action configuration.
`static class` `AutoScalingConfig.TriggerConfig` Bean representation of trigger config.
`static class` `AutoScalingConfig.TriggerListenerConfig` Bean representation of trigger listener config.

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

`MapWriter.EntryWriter`

### Constructor Summary

Constructors
Constructor and Description
`AutoScalingConfig(byte[] utf8)` Construct from bytes that represent a UTF-8 JSON string.
`AutoScalingConfig(Map<String,Object> jsonMap)` Construct from a JSON map representation.
`AutoScalingConfig(Policy policy, Map<String,AutoScalingConfig.TriggerConfig> triggerConfigs, Map<String,AutoScalingConfig.TriggerListenerConfig> listenerConfigs, Map<String,Object> properties, int zkVersion)`

### Method Summary

All Methods Instance Methods Concrete Methods
`Object` `clone()`
`boolean` `equals(Object o)`
`Policy` `getPolicy()` Get `Policy` configuration.
`Map<String,Object>` `getProperties()`
`Map<String,AutoScalingConfig.TriggerConfig>` `getTriggerConfigs()` Get trigger configurations.
`Map<String,AutoScalingConfig.TriggerListenerConfig>` `getTriggerListenerConfigs()` Get listener configurations.
`int` `getZkVersion()` Return the znode version that was used to create this configuration.
`boolean` `hasTriggerForEvents(TriggerEventType... types)` Check whether triggers for specific event type exist.
`boolean` `isEmpty()` Return true if the source `autoscaling.json` was empty, false otherwise.
`String` `toString()`
`AutoScalingConfig` `withoutTriggerConfig(String name)` Create a copy of the config without a trigger configuration.
`AutoScalingConfig` `withoutTriggerListenerConfig(String name)` Create a copy of the config without a trigger listener configuration.
`AutoScalingConfig` `withPolicy(Policy policy)` Create a copy of the config with replaced policy.
`AutoScalingConfig` `withProperties(Map<String,Object> properties)` Create a copy of the config with replaced properties.
`AutoScalingConfig` `withTriggerConfig(AutoScalingConfig.TriggerConfig config)` Create a copy of the config with replaced trigger configuration
`AutoScalingConfig` `withTriggerConfigs(Map<String,AutoScalingConfig.TriggerConfig> configs)` Create a copy of the config with replaced trigger configurations.
`AutoScalingConfig` `withTriggerListenerConfig(AutoScalingConfig.TriggerListenerConfig config)` Create a copy of the config with replaced trigger listener configuration.
`AutoScalingConfig` `withTriggerListenerConfigs(Map<String,AutoScalingConfig.TriggerListenerConfig> configs)` Create a copy of the config with replaced trigger listener configurations.
`void` `writeMap(MapWriter.EntryWriter ew)`

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

`finalize, getClass, hashCode, 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`

### Constructor Detail

#### AutoScalingConfig

    public AutoScalingConfig(byte[] utf8)

Construct from bytes that represent a UTF-8 JSON string.

Parameters:
  `utf8` - config data

#### AutoScalingConfig

    public AutoScalingConfig(Map<String,Object> jsonMap)

Construct from a JSON map representation.

Parameters:
  `jsonMap` - JSON map representation of the config. Note that this map is evaluated lazily, and outside modifications may cause unpredictable behavior.

#### AutoScalingConfig

    public AutoScalingConfig(Policy policy,
                             Map<String,AutoScalingConfig.TriggerConfig> triggerConfigs,
                             Map<String,AutoScalingConfig.TriggerListenerConfig> listenerConfigs,
                             Map<String,Object> properties,
                             int zkVersion)

### Method Detail

#### isEmpty

    public boolean isEmpty()

Return true if the source `autoscaling.json` was empty, false otherwise.

#### getPolicy

    public Policy getPolicy()

Get `Policy` configuration.

#### getTriggerConfigs

    public Map<String,AutoScalingConfig.TriggerConfig> getTriggerConfigs()

Get trigger configurations.

#### hasTriggerForEvents

    public boolean hasTriggerForEvents(TriggerEventType... types)

Check whether triggers for specific event type exist.

Parameters:
  `types` - list of event types
Returns:
  true if there's at least one trigger matching at least one event type, false otherwise,

#### getTriggerListenerConfigs

    public Map<String,AutoScalingConfig.TriggerListenerConfig> getTriggerListenerConfigs()

Get listener configurations.

#### getProperties

    public Map<String,Object> getProperties()

#### withProperties

    public AutoScalingConfig withProperties(Map<String,Object> properties)

Create a copy of the config with replaced properties.

Parameters:
  `properties` - the new properties map
Returns:
  modified copy of the configuration

#### withPolicy

    public AutoScalingConfig withPolicy(Policy policy)

Create a copy of the config with replaced policy.

Parameters:
  `policy` - new policy
Returns:
  modified copy of the configuration

#### withTriggerConfigs

    public AutoScalingConfig withTriggerConfigs(Map<String,AutoScalingConfig.TriggerConfig> configs)

Create a copy of the config with replaced trigger configurations.

Parameters:
  `configs` - new trigger configurations
Returns:
  modified copy of the configuration

#### withTriggerConfig

    public AutoScalingConfig withTriggerConfig(AutoScalingConfig.TriggerConfig config)

Create a copy of the config with replaced trigger configuration

Parameters:
  `config` - new trigger configuration
Returns:
  modified copy of the configuration

#### withoutTriggerConfig

    public AutoScalingConfig withoutTriggerConfig(String name)

Create a copy of the config without a trigger configuration.

Parameters:
  `name` - trigger configuration name
Returns:
  modified copy of the configuration, even if the specified config name didn't exist.

#### withTriggerListenerConfigs

    public AutoScalingConfig withTriggerListenerConfigs(Map<String,AutoScalingConfig.TriggerListenerConfig> configs)

Create a copy of the config with replaced trigger listener configurations.

Parameters:
  `configs` - new trigger listener configurations
Returns:
  modified copy of the configuration

#### withTriggerListenerConfig

    public AutoScalingConfig withTriggerListenerConfig(AutoScalingConfig.TriggerListenerConfig config)

Create a copy of the config with replaced trigger listener configuration.

Parameters:
  `config` - new trigger listener configuration
Returns:
  modified copy of the configuration

#### withoutTriggerListenerConfig

    public AutoScalingConfig withoutTriggerListenerConfig(String name)

Create a copy of the config without a trigger listener configuration.

Parameters:
  `name` - trigger listener configuration name
Returns:
  modified copy of the configuration, even if the specified config name didn't exist.

#### clone

    public Object clone()

Overrides:
  `clone` in class `Object`

#### getZkVersion

    public int getZkVersion()

Return the znode version that was used to create this configuration.

#### writeMap

    public void writeMap(MapWriter.EntryWriter ew)
                  throws IOException

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

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### equals

    public boolean equals(Object o)

Overrides:
  `equals` in class `Object`