org.apache.solr.common.params
Class RequiredSolrParams

java.lang.Object
  extended by org.apache.solr.common.params.SolrParams
      extended by org.apache.solr.common.params.RequiredSolrParams
All Implemented Interfaces:
Serializable

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

Field Summary
protected  SolrParams params
           
 
Constructor Summary
RequiredSolrParams(SolrParams params)
           
 
Method Summary
 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 none
 String toString()
           
 
Methods inherited from class org.apache.solr.common.params.SolrParams
fpname, getBool, getDouble, getDouble, getFieldBool, getFieldDouble, getFieldDouble, getFieldFloat, getFieldInt, getFloat, getInt, required, toFilteredSolrParams, toMap, toMultiMap, toNamedList, toSolrParams, wrapAppended, wrapDefaults
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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 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 none

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()
Overrides:
toString in class Object

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)


Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.