Package org.apache.solr.common.params

# Class RequiredSolrParams

java.lang.Object
org.apache.solr.common.params.SolrParams
org.apache.solr.common.params.RequiredSolrParams

All Implemented Interfaces:
  `Serializable`, `Iterable<Map.Entry<String,String[]>>`, `MapSerializable`, `MapWriter`, `NavigableObject`, `org.noggit.JSONWriter.Writable`

public class RequiredSolrParams extends SolrParams
This is a simple wrapper to SolrParams that will throw a 400 exception if you ask for a parameter that does not exist. Fields specified with

In short, any value you for from a `RequiredSolrParams` will return a valid non-null value or throw a 400 exception. (If you pass in `null` as the default value, you can get a null return value)

Since:
  solr 1.2
See Also:
  - Serialized Form

## Nested Class Summary

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

`MapWriter.EntryWriter`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final SolrParams`
`params`

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

`EMPTY`

## Constructor Summary

Constructors
Constructor
Description
`RequiredSolrParams(SolrParams params)`

## Method Summary

Modifier and Type
Method
Description
`void`
`check(String... params)`
`String`
`get(String param)`
get the param from params, fail if not found *
`String`
`get(String param, String def)`
returns the value of the param, or def if not set
`boolean`
`getBool(String param, boolean def)`
Returns the boolean value of the param, or def if not set
`boolean`
`getFieldBool(String field, String param, boolean def)`
Returns the boolean value of the field param, or the value for param, or def if neither is set.
`float`
`getFieldFloat(String field, String param, float def)`
Returns the float value of the field param, or the value for param, or def if neither is set.
`int`
`getFieldInt(String field, String param, int def)`
Returns the int value of the field param, or the value for param, or def if neither is set.
`String`
`getFieldParam(String field, String param)`
returns the String value of the field parameter, "f.field.param", or the value for "param" if that is not set.
`String`
`getFieldParam(String field, String param, String def)`
returns the String value of the field parameter, "f.field.param", or the value for "param" if that is not set.
`String[]`
`getFieldParams(String field, String param)`
returns the String values of the field parameter, "f.field.param", or the values for "param" if that is not set.
`float`
`getFloat(String param, float def)`
Returns the float value of the param, or def if not set
`int`
`getInt(String param, int def)`
Returns the int value of the param, or def if not set
`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 no mapping for the param exists.
`String`
`toString()`
Like `SolrParams.toQueryString()`, but only replacing enough chars so that the URL may be unambiguously pasted back into a browser.

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

`equals, fpname, getBool, getDouble, getDouble, getFieldBool, getFieldDouble, getFieldDouble, getFieldFloat, getFieldInt, getFloat, getInt, getLong, getLong, getPrimitiveBool, getPrimitiveFieldBool, getPrimitiveFieldFloat, getPrimitiveInt, hashCode, iterator, of, of, required, stream, toLocalParamsString, toNamedList, toQueryString, wrapAppended, wrapDefaults, writeMap`

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

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

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

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

`jsonStr, toMap, write`

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

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

## Field Details

### params

protected final SolrParams params

## Constructor Details

### RequiredSolrParams

public RequiredSolrParams(SolrParams params)

## Method Details

### get

public String get(String param)
get the param from params, fail if not found *

Specified by:
  `get` in class `SolrParams`

### getFieldParam

public String getFieldParam(String field, String param)
Description copied from class: `SolrParams`
returns the String value of the field parameter, "f.field.param", or the value for "param" if that is not set.

Overrides:
  `getFieldParam` in class `SolrParams`

### getFieldParams

public String[] getFieldParams(String field, String param)
Description copied from class: `SolrParams`
returns the String values of the field parameter, "f.field.param", or the values for "param" if that is not set.

Overrides:
  `getFieldParams` in class `SolrParams`

### getParams

public String[] getParams(String param)
Description copied from class: `SolrParams`
returns an array of the String values of a param, or null if no mapping for the param exists.

Specified by:
  `getParams` in class `SolrParams`

### getParameterNamesIterator

public Iterator<String> getParameterNamesIterator()
returns an Iterator over the parameter names

Specified by:
  `getParameterNamesIterator` in class `SolrParams`

### toString

public String toString()
Description copied from class: `SolrParams`
Like `SolrParams.toQueryString()`, but only replacing enough chars so that the URL may be unambiguously pasted back into a browser. This method can be used to properly log query parameters without making them unreadable.

Characters with a numeric value less than 32 are encoded. &,=,%,+,space are encoded.

Overrides:
  `toString` in class `SolrParams`

### get

public String get(String param, String def)
Description copied from class: `SolrParams`
returns the value of the param, or def if not set

Overrides:
  `get` in class `SolrParams`

### getInt

public int getInt(String param, int def)
Description copied from class: `SolrParams`
Returns the int value of the param, or def if not set

Overrides:
  `getInt` in class `SolrParams`

### getFloat

public float getFloat(String param, float def)
Description copied from class: `SolrParams`
Returns the float value of the param, or def if not set

Overrides:
  `getFloat` in class `SolrParams`

### getBool

public boolean getBool(String param, boolean def)
Description copied from class: `SolrParams`
Returns the boolean value of the param, or def if not set

Overrides:
  `getBool` in class `SolrParams`

### getFieldInt

public int getFieldInt(String field, String param, int def)
Description copied from class: `SolrParams`
Returns the int value of the field param, or the value for param, or def if neither is set.

Overrides:
  `getFieldInt` in class `SolrParams`

### getFieldBool

public boolean getFieldBool(String field, String param, boolean def)
Description copied from class: `SolrParams`
Returns the boolean value of the field param, or the value for param, or def if neither is set.

Overrides:
  `getFieldBool` in class `SolrParams`

### getFieldFloat

public float getFieldFloat(String field, String param, float def)
Description copied from class: `SolrParams`
Returns the float value of the field param, or the value for param, or def if neither is set.

Overrides:
  `getFieldFloat` in class `SolrParams`

### getFieldParam

public String getFieldParam(String field, String param, String def)
Description copied from class: `SolrParams`
returns the String value of the field parameter, "f.field.param", or the value for "param" if that is not set. If that is not set, def

Overrides:
  `getFieldParam` in class `SolrParams`

### check

public void check(String... params)