java.lang.Object
org.cruk.clarity.api.search.SearchTerm
All Implemented Interfaces:
Serializable

public class SearchTerm extends Object implements Serializable
Class recording an individual parameter and its value or values of a call to the API's find method.
See Also:
  • Constructor Details

    • SearchTerm

      public SearchTerm(String param)
      Create a search term with no values.
      Parameters:
      param - The parameter name.
      Throws:
      IllegalArgumentException - if param is null or empty.
    • SearchTerm

      public SearchTerm(String param, Collection<? extends Object> values)
      Create a search term with the given values.
      Parameters:
      param - The parameter name.
      values - A collection of values to search for with this parameter.
      Throws:
      IllegalArgumentException - if param is null or empty.
  • Method Details

    • getParam

      public String getParam()
      Get the parameter name.
      Returns:
      The parameter name.
    • setParam

      public void setParam(String param)
      Set the parameter name.
      Parameters:
      param - The parameter name.
      Throws:
      IllegalArgumentException - if param is null or empty.
    • getValues

      public List<String> getValues()
      Get the values to search for for this parameter.
      Returns:
      A list of values.
    • setValues

      public void setValues(Stream<? extends Object> values)
      Set the values to search for from a stream.
      Parameters:
      values - The values to search for. Any null or empty values are filtered out.
    • setValues

      public void setValues(Collection<? extends Object> values)
      Set the values to search for from a collection.
      Parameters:
      values - The values to search for. Any null or empty values are filtered out.
    • setValues

      public void setValues(Object[] values)
      Set the values to search for from an array.
      Parameters:
      values - The values to search for. Any null or empty values are filtered out.
    • setValue

      public void setValue(Object value)
      Set the single value to search for.
      Parameters:
      value - The value.
    • hashCode

      public int hashCode()
      Override of hash code. The hash should be based on the parameter name and the values. The order of values is not important.
      Overrides:
      hashCode in class Object
      Returns:
      A hash code for this search term.
    • equals

      public boolean equals(Object obj)
      Test whether the given object is equal to this SearchTerm. It will be if it is also a SearchTerm object that has the same parameter name with the same search values (order unimportant).
      Overrides:
      equals in class Object
      Parameters:
      obj - The object to compare to.
      Returns:
      True if this object is value equal to obj, false if not.
    • toString

      public String toString()
      Get a human readable representation of this object. Gives the parameter name and values.
      Overrides:
      toString in class Object
      Returns:
      A printable representation of this object.