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
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 withIn short, any value you for from a
RequiredSolrParams
will return a valid non-null value or throw a 400 exception. (If you pass innull
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 SolrParams
params
-
Constructor Summary
Constructors Constructor Description RequiredSolrParams(SolrParams params)
-
Method Summary
All Methods Instance Methods Concrete Methods 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 setboolean
getBool(String param, boolean def)
Returns the boolean value of the param, or def if not setboolean
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 setint
getInt(String param, int def)
Returns the int value of the param, or def if not setIterator<String>
getParameterNamesIterator()
returns an Iterator over the parameter namesString[]
getParams(String param)
returns an array of the String values of a param, or null if no mapping for the param exists.String
toString()
LikeSolrParams.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
fpname, getAll, getAll, getBool, getDouble, getDouble, getFieldBool, getFieldDouble, getFieldDouble, getFieldFloat, getFieldInt, getFloat, getInt, getLong, getLong, getPrimitiveBool, getPrimitiveFieldBool, getPrimitiveFieldFloat, getPrimitiveInt, iterator, required, stream, toFilteredSolrParams, toLocalParamsString, toMap, toMultiMap, toNamedList, toQueryString, toSolrParams, wrapAppended, wrapDefaults, writeMap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface org.apache.solr.common.NavigableObject
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size
-
-
-
-
Field Detail
-
params
protected final SolrParams params
-
-
Constructor Detail
-
RequiredSolrParams
public RequiredSolrParams(SolrParams params)
-
-
Method Detail
-
get
public String get(String param)
get the param from params, fail if not found *- Specified by:
get
in classSolrParams
-
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 classSolrParams
-
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 classSolrParams
-
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 classSolrParams
-
getParameterNamesIterator
public Iterator<String> getParameterNamesIterator()
returns an Iterator over the parameter names- Specified by:
getParameterNamesIterator
in classSolrParams
-
toString
public String toString()
Description copied from class:SolrParams
LikeSolrParams.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 classSolrParams
-
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 classSolrParams
-
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 classSolrParams
-
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 classSolrParams
-
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 classSolrParams
-
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 classSolrParams
-
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 classSolrParams
-
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 classSolrParams
-
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 classSolrParams
-
check
public void check(String... params)
-
-