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, org.noggit.JSONWriter.Writable

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:
  • Field Details

  • Constructor Details

    • RequiredSolrParams

      public RequiredSolrParams(SolrParams params)
  • Method Details

    • 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 no mapping for the param exists.
      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()
      Description copied from class: SolrParams
      Like SolrParams.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 class SolrParams
    • 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)