org.apache.solr.common.params

## Class ModifiableSolrParams

- java.lang.Object
- - org.apache.solr.common.params.SolrParams
  - - org.apache.solr.common.params.ModifiableSolrParams

All Implemented Interfaces:
  Serializable

Direct Known Subclasses:
  SolrQuery

    public class ModifiableSolrParams
    extends SolrParams

This class is similar to MultiMapSolrParams except you can edit the parameters after it is initialized. It has helper functions to set/add integer and boolean param values.

Since:
  solr 1.3
See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`ModifiableSolrParams()`
`ModifiableSolrParams(Map<String,String[]> v)` Constructs a new ModifiableSolrParams directly using the provided Map<String,String[]>
`ModifiableSolrParams(SolrParams params)` Constructs a new ModifiableSolrParams, copying values from an existing SolrParams

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `add(SolrParams params)`
`ModifiableSolrParams` `add(String name, String... val)` Add the given values to any existing name
`void` `clear()` clear all parameters
`String` `get(String param)` returns the String value of a param, or null if not set
`Map<String,String[]>` `getMap()`
`Set<String>` `getParameterNames()`
`Iterator<String>` `getParameterNamesIterator()` returns an Iterator over the parameter names
`String[]` `getParams(String param)` returns an array of the String values of a param, or null if none
`String[]` `remove(String name)` remove a field at the given name
`boolean` `remove(String name, String value)` remove the given value for the given name
`ModifiableSolrParams` `set(String name, boolean val)`
`ModifiableSolrParams` `set(String name, int val)`
`ModifiableSolrParams` `set(String name, String... val)` Replace any existing parameter with the given name.
`int` `size()`

### Methods inherited from class org.apache.solr.common.params.SolrParams

`fpname, get, getAll, getAll, getBool, getBool, getDouble, getDouble, getFieldBool, getFieldBool, getFieldDouble, getFieldDouble, getFieldFloat, getFieldFloat, getFieldInt, getFieldInt, getFieldParam, getFieldParam, getFieldParams, getFloat, getFloat, getInt, getInt, getLong, getLong, getLong, required, toFilteredSolrParams, toMap, toMultiMap, toNamedList, toQueryString, toSolrParams, toString, wrapAppended, wrapDefaults`

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

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

### Constructor Detail

#### ModifiableSolrParams

    public ModifiableSolrParams()

#### ModifiableSolrParams

    public ModifiableSolrParams(Map<String,String[]> v)

Constructs a new ModifiableSolrParams directly using the provided Map<String,String[]>

#### ModifiableSolrParams

    public ModifiableSolrParams(SolrParams params)

Constructs a new ModifiableSolrParams, copying values from an existing SolrParams

### Method Detail

#### size

    public int size()

#### getMap

    public Map<String,String[]> getMap()

#### set

    public ModifiableSolrParams set(String name,
                                    String... val)

Replace any existing parameter with the given name. if val==null remove key from params completely.

#### set

    public ModifiableSolrParams set(String name,
                                    int val)

#### set

    public ModifiableSolrParams set(String name,
                                    boolean val)

#### add

    public ModifiableSolrParams add(String name,
                                    String... val)

Add the given values to any existing name

Parameters:
  `name` - Key
  `val` - Array of value(s) added to the name. NOTE: If val is null or a member of val is null, then a corresponding null reference will be included when a get method is called on the key later.
Returns:
  this

#### add

    public void add(SolrParams params)

#### remove

    public String[] remove(String name)

remove a field at the given name

#### clear

    public void clear()

clear all parameters

#### remove

    public boolean remove(String name,
                          String value)

remove the given value for the given name

Returns:
  true if the item was removed, false if null or not present

#### get

    public String get(String param)

Description copied from class: `SolrParams`
returns the String value of a param, or null if not set

Specified by:
  `get` in class `SolrParams`

#### getParameterNamesIterator

    public Iterator<String> getParameterNamesIterator()

Description copied from class: `SolrParams`
returns an Iterator over the parameter names

Specified by:
  `getParameterNamesIterator` in class `SolrParams`

#### getParameterNames

    public Set<String> getParameterNames()

#### getParams

    public String[] getParams(String param)

Description copied from class: `SolrParams`
returns an array of the String values of a param, or null if none

Specified by:
  `getParams` in class `SolrParams`