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
 
 public class ModifiableSolrParams extends SolrParams This class is similar toMultiMapSolrParamsexcept 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
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.apache.solr.common.MapWriterMapWriter.EntryWriter
 
- 
 - 
Constructor SummaryConstructors Constructor 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 SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ModifiableSolrParamsadd(String name, String... val)Add the given values to any existing namevoidadd(SolrParams params)Add all the params provided in the parameter to this params.voidclear()clear all parametersStringget(String param)Returns the first 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 no mapping for the param exists.Iterator<Map.Entry<String,String[]>>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(String name)remove a field at the given namebooleanremove(String name, String value)remove the given value for the given nameModifiableSolrParamsset(String name, boolean val)ModifiableSolrParamsset(String name, int val)ModifiableSolrParamsset(String name, String... val)Replace any existing parameter with the given name.ModifiableSolrParamssetNonNull(String name, Object val)intsize()- 
Methods inherited from class org.apache.solr.common.params.SolrParamsfpname, 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, required, stream, toLocalParamsString, toNamedList, toQueryString, toString, wrapAppended, wrapDefaults, writeMap
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface java.lang.IterableforEach, spliterator
 - 
Methods inherited from interface org.apache.solr.common.NavigableObject_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size
 
- 
 
- 
- 
- 
Constructor Detail- 
ModifiableSolrParamspublic ModifiableSolrParams() 
 - 
ModifiableSolrParamspublic ModifiableSolrParams(Map<String,String[]> v) Constructs a new ModifiableSolrParams directly using the provided Map<String,String[]>
 - 
ModifiableSolrParamspublic ModifiableSolrParams(SolrParams params) Constructs a new ModifiableSolrParams, copying values from an existing SolrParams
 
- 
 - 
Method Detail- 
ofpublic static ModifiableSolrParams of(SolrParams params) 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.
 - 
sizepublic int size() 
 - 
setNonNullpublic ModifiableSolrParams setNonNull(String name, Object val) 
 - 
setpublic ModifiableSolrParams set(String name, String... val) Replace any existing parameter with the given name. if val==null remove key from params completely.
 - 
setpublic ModifiableSolrParams set(String name, int val) 
 - 
setpublic ModifiableSolrParams set(String name, boolean val) 
 - 
addpublic 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
 
 - 
addpublic void add(SolrParams params) Add all the params provided in the parameter to this params. Any current value(s) for the same key will be overridden.
 - 
clearpublic void clear() clear all parameters
 - 
removepublic 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
 
 - 
getpublic String get(String param) 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 class- SolrParams
 
 - 
getParameterNamesIteratorpublic Iterator<String> 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 class- SolrParams
 
 - 
getParamspublic String[] getParams(String param) 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 class- SolrParams
 
 - 
iteratorpublic Iterator<Map.Entry<String,String[]>> iterator() Description copied from class:SolrParamsReturns an Iterator ofMap.Entryproviding a multi-map view. Treat it as read-only.
 
- 
 
-