public abstract class SolrParams extends Object implements Serializable, MapWriter, Iterable<Map.Entry<String,String[]>>
MapWriter.EntryWriter
Constructor and Description |
---|
SolrParams() |
Modifier and Type | Method and Description |
---|---|
protected String |
fpname(String field,
String param) |
abstract String |
get(String param)
Returns the first String value of a param, or null if not set.
|
String |
get(String param,
String def)
returns the value of the param, or def if not set
|
Map<String,Object> |
getAll(Map<String,Object> sink,
Collection<String> params)
Deprecated.
|
Map<String,Object> |
getAll(Map<String,Object> sink,
String... params)
Deprecated.
|
Boolean |
getBool(String param)
Returns the Boolean value of the param, or null if not set.
|
boolean |
getBool(String param,
boolean def)
Returns the boolean value of the param, or def if not set
|
Double |
getDouble(String param)
Returns the Float value of the param, or null if not set
Use this method only when you want to be explicit
about absence of a value (
null ) vs the default value zero (0.0d ). |
double |
getDouble(String param,
double def)
Returns the float value of the param, or def if not set
|
Boolean |
getFieldBool(String field,
String param)
Returns the Boolean value of the field param,
or the value for param, or null if neither is 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.
|
Double |
getFieldDouble(String field,
String param)
Returns the float value of the field param.
|
double |
getFieldDouble(String field,
String param,
double def)
Returns the float value of the field param,
or the value for param, or def if neither is set.
|
Float |
getFieldFloat(String field,
String param)
Returns the float value of the field param.
|
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.
|
Integer |
getFieldInt(String field,
String param)
Use this method only when you want to be explicit
about absence of a value (
null ) vs the default value zero (0 ). |
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)
Returns the Float value of the param, or null if not set
Use this method only when you want to be explicit
about absence of a value (
null ) vs the default value zero (0.0f ). |
float |
getFloat(String param,
float def)
Returns the float value of the param, or def if not set
|
Integer |
getInt(String param)
Returns the Integer value of the param, or null if not set
Use this method only when you want to be explicit
about absence of a value (
null ) vs the default value for int -
zero (0 ). |
int |
getInt(String param,
int def)
Returns the int value of the param, or def if not set
|
Long |
getLong(String param)
Returns the Long value of the param, or null if not set
Use this method only when you want to be explicit
about absence of a value (
null ) vs the default value zero (0 ). |
long |
getLong(String param,
long def)
Returns the long value of the param, or def if not set
|
abstract Iterator<String> |
getParameterNamesIterator()
Returns an Iterator over the parameter names.
|
abstract String[] |
getParams(String param)
returns an array of the String values of a param, or null if no mapping for the param exists.
|
boolean |
getPrimitiveBool(String param)
Returns the boolean value of the param, or
false if not set |
boolean |
getPrimitiveFieldBool(String field,
String param)
Returns the boolean value of the field param, or
the value for param or
the default value of boolean -
false |
float |
getPrimitiveFieldFloat(String field,
String param)
Returns the float value of the field param or
the value for param or
the default value for float - zero (
0.0f ) |
int |
getPrimitiveInt(String param)
Returns int value of the the param or
default value for int - zero (
0 ) if not set. |
Iterator<Map.Entry<String,String[]>> |
iterator()
Returns an Iterator of
Map.Entry providing a multi-map view. |
RequiredSolrParams |
required()
returns a RequiredSolrParams wrapping this
|
Stream<Map.Entry<String,String[]>> |
stream()
A
Stream view over iterator() -- for convenience. |
SolrParams |
toFilteredSolrParams(List<String> names)
Deprecated.
|
String |
toLocalParamsString()
Generates a local-params string of the form
|
static Map<String,String> |
toMap(NamedList params)
Deprecated.
|
static Map<String,String[]> |
toMultiMap(NamedList params)
Deprecated.
|
NamedList<Object> |
toNamedList()
Convert this to a NamedList of unique keys with either String or String[] values depending on
how many values there are for the parameter.
|
String |
toQueryString()
Returns this SolrParams as a properly URL encoded string, starting with
"?" , if not empty. |
static SolrParams |
toSolrParams(NamedList params)
Deprecated.
|
String |
toString()
Like
toQueryString() , but only replacing enough chars so that
the URL may be unambiguously pasted back into a browser. |
static SolrParams |
wrapAppended(SolrParams params,
SolrParams defaults) |
static SolrParams |
wrapDefaults(SolrParams params,
SolrParams defaults) |
void |
writeMap(MapWriter.EntryWriter ew) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr
forEach, spliterator
public abstract String get(String param)
getParams(String)
instead.public abstract String[] getParams(String param)
public abstract Iterator<String> getParameterNamesIterator()
Iterable
.public void writeMap(MapWriter.EntryWriter ew) throws IOException
writeMap
in interface MapWriter
IOException
public Iterator<Map.Entry<String,String[]>> iterator()
Map.Entry
providing a multi-map view. Treat it as read-only.public Stream<Map.Entry<String,String[]>> stream()
Stream
view over iterator()
-- for convenience. Treat it as read-only.public RequiredSolrParams required()
public String getFieldParam(String field, String param)
public String getFieldParam(String field, String param, String def)
public String[] getFieldParams(String field, String param)
public Boolean getBool(String param)
null
) vs the default value false
.getBool(String, boolean)
,
getPrimitiveBool(String)
public boolean getPrimitiveBool(String param)
false
if not setpublic boolean getBool(String param, boolean def)
public Boolean getFieldBool(String field, String param)
null
) vs the default value false
.public boolean getPrimitiveFieldBool(String field, String param)
false
public boolean getFieldBool(String field, String param, boolean def)
public Integer getInt(String param)
null
) vs the default value for int -
zero (0
).getInt(String, int)
,
getPrimitiveInt(String)
public int getPrimitiveInt(String param)
0
) if not set.public int getInt(String param, int def)
public Long getLong(String param)
null
) vs the default value zero (0
).getLong(String, long)
public long getLong(String param, long def)
public Integer getFieldInt(String field, String param)
null
) vs the default value zero (0
).null
if neither is set.getFieldInt(String, String, int)
public int getFieldInt(String field, String param, int def)
public Float getFloat(String param)
null
) vs the default value zero (0.0f
).getFloat(String, float)
public float getFloat(String param, float def)
public Double getDouble(String param)
null
) vs the default value zero (0.0d
).getDouble(String, double)
public double getDouble(String param, double def)
public Float getFieldFloat(String field, String param)
null
) vs the default value zero (0.0f
).public float getPrimitiveFieldFloat(String field, String param)
0.0f
)public float getFieldFloat(String field, String param, float def)
public Double getFieldDouble(String field, String param)
null
) vs the default value zero (0.0d
).getDouble(String, double)
public double getFieldDouble(String field, String param, double def)
public static SolrParams wrapDefaults(SolrParams params, SolrParams defaults)
public static SolrParams wrapAppended(SolrParams params, SolrParams defaults)
@Deprecated public static Map<String,String> toMap(NamedList params)
@Deprecated public static Map<String,String[]> toMultiMap(NamedList params)
@Deprecated public static SolrParams toSolrParams(NamedList params)
NamedList.toSolrParams()
.@Deprecated public SolrParams toFilteredSolrParams(List<String> names)
public NamedList<Object> toNamedList()
@Deprecated public Map<String,Object> getAll(Map<String,Object> sink, Collection<String> params)
@Deprecated public Map<String,Object> getAll(Map<String,Object> sink, String... params)
public String toQueryString()
"?"
, if not empty.public String toLocalParamsString()
{! name=value name2=value2}.
public String toString()
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.
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.