Package 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,Iterable<Map.Entry<String,,String[]>> MapSerializable,MapWriter,NavigableObject,org.noggit.JSONWriter.Writable
- Direct Known Subclasses:
SolrQuery
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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.solr.common.MapWriter
MapWriter.EntryWriter -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionModifiableSolrParams(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
Modifier and TypeMethodDescriptionAdd the given values to any existing namevoidadd(SolrParams params) Add all the params provided in the parameter to this params.voidclear()clear all parametersReturns the first String value of a param, or null if not set.getMap()Returns an Iterator over the parameter names.String[]returns an array of the String values of a param, or null if no mapping for the param exists.iterator()Returns an Iterator ofMap.Entryproviding a multi-map view.static ModifiableSolrParamsof(SolrParams params) If the input params are of type ModifiableSolrParams, returns the input, otherwise, constructs a new ModifiableSolrParams, copying values from the given params.String[]remove a field at the given namebooleanremove the given value for the given nameReplace any existing parameter with the given name.setNonNull(String name, Object val) intsize()Methods inherited from class org.apache.solr.common.params.SolrParams
equals, fpname, get, getBool, getBool, getDouble, getDouble, getFieldBool, getFieldBool, getFieldDouble, getFieldDouble, getFieldFloat, getFieldFloat, getFieldInt, getFieldInt, getFieldParam, getFieldParam, getFieldParams, getFloat, getFloat, getInt, getInt, getLong, getLong, getPrimitiveBool, getPrimitiveFieldBool, getPrimitiveFieldFloat, getPrimitiveInt, hashCode, of, of, required, stream, toLocalParamsString, toNamedList, toQueryString, toString, wrapAppended, wrapDefaults, writeMapMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.apache.solr.common.NavigableObject
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size
-
Constructor Details
-
ModifiableSolrParams
public ModifiableSolrParams() -
ModifiableSolrParams
Constructs a new ModifiableSolrParams directly using the provided Map<String,String[]> -
ModifiableSolrParams
Constructs a new ModifiableSolrParams, copying values from an existing SolrParams
-
-
Method Details
-
of
If the input params are of type ModifiableSolrParams, returns the input, otherwise, constructs a new ModifiableSolrParams, copying values from the given params. If params is null, returns an empty ModifiableSolrParams instance. -
size
public int size() -
getMap
-
setNonNull
-
set
Replace any existing parameter with the given name. if val==null remove key from params completely. -
set
-
set
-
add
Add the given values to any existing name- Parameters:
name- Keyval- 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
Add all the params provided in the parameter to this params. Any current value(s) for the same key will be overridden. -
remove
remove a field at the given name -
clear
public void clear()clear all parameters -
remove
remove the given value for the given name- Returns:
- true if the item was removed, false if null or not present
-
get
Description copied from class:SolrParamsReturns the first String value of a param, or null if not set. To get all, callSolrParams.getParams(String)instead.- Specified by:
getin classSolrParams
-
getParameterNamesIterator
Description copied from class:SolrParamsReturns an Iterator over the parameter names. If you were to call a getter for this parameter, you should get a non-null value. Since you probably want the value, consider using Java 5 for-each style instead for convenience since a SolrParams implementsIterable.- Specified by:
getParameterNamesIteratorin classSolrParams
-
getParameterNames
-
getParams
Description copied from class:SolrParamsreturns an array of the String values of a param, or null if no mapping for the param exists.- Specified by:
getParamsin classSolrParams
-
iterator
Description copied from class:SolrParamsReturns an Iterator ofMap.Entryproviding a multi-map view. Treat it as read-only.
-