Class Filter

java.lang.Object
overit.geocall.sql.code.criterion.Criterion
overit.geocall.sql.code.criterion.Filter
All Implemented Interfaces:
Cloneable

public class Filter extends Criterion
The class extends Criterion and aims to define a specifc filter on a given string-pattern.
For example if you instantiate a filter object like this "newFilter ('AUSENAME'). OnValue ()", you want to discard the value associated with the given "AUSENAME" key.
  • Field Details

  • Constructor Details

  • Method Details

    • onAny

      public static Filter onAny()
      Instantiates a new filter that discards all the records valued.
      Returns:
      A new filter that discards all the records valued.
    • onName

      public static Filter onName(String pattern)
      Instantiates a new filter that discards the value associated with a specific key defined by the given string pattern.
      Parameters:
      pattern - The string pattern for which we want to discard the value.
      Returns:
      A new filter that discards the value associated with a specific key defined by the given string pattern.
    • onType

      public static Filter onType(Class clz)
      Instantiates a new filter that discards all the value of a specific class type clz.
      For example all Integer values, all String value ecc.
      Parameters:
      clz - The type of the class whose input values ??are to be discarded.
      Returns:
      A new filter that discards all the value of a specific class type clz.
    • onValue

      public static Filter onValue(Class clz, String valuePattern)
      Instantiates a new filter that discards all the value that match with the valuePattern and with the type class clz, passed by input.
      For example all String values that start with the 'a' charcter.
      Parameters:
      clz - The type of the class whose input values must match to be discarded.
      valuePattern - The patter on which the values must match to be discarded.
      Returns:
      A new filter that discards all the value that match with the valuePattern and with the type class clz, passed by input.
    • on

      public static Filter on()
      Instantiates a new filter that discards all clauses that match with a null set.
      Returns:
      A new filter that discards all clauses that match with a null set.
    • onUsefulString

      public static Filter onUsefulString()
      Instantiates a new filter that discards all the clauses that contains a match with useless strings.
      Returns:
      A new filter that discards all the clauses that contains a match with useless strings.
    • onUsefulLike

      public static Filter onUsefulLike()
      Instantiates a new filter that discards all the LIKE clauses (given by input) relating to a string formed by the following reg-exp ".*%.*", which begins and ends with at least one character and inside it presents the '%' character.
      For example if the following string "a%b" is passed to be evaluated with the like clause (for example "AUSENAME LIKE a%b"), the string will be discarded.
      Returns:
      A new filter that discards all the LIKE clauses (given by input) relating to a string formed by the following reg-exp ".*%.*" .
    • onNull

      public static Filter onNull()
      Instantiates a new filter that discards all clauses that doesn't match with a null set.
      Returns:
      A new filter that discards all clauses that doesn't match with a null set.
    • onUselessString

      public static Filter onUselessString()
      Instantiates a new filter that discards all the clauses that match with usefull strings.
      Returns:
      A new filter that discards all the clauses that match with usefull strings..
    • onUselessLike

      public static Filter onUselessLike()
      Instantiates a new filter that discards all the clauses that match with usefull-like strings.
      Returns:
      A new filter that discards all the clauses that match with usefull-like strings.
    • onValues

      public static Filter onValues(Collection inValues, Collection outValues)
      Instantiates a new filter that discards all the clauses that doesn't match with the inValues and/or match with the outValues.
      Parameters:
      inValues - A values Collection that represent the set that must match in order to not discard the clause.
      outValues - A values Collection that represent the set that must match in order to discard the clause.
      Returns:
      A new filter that discards all the clauses that doesn't match with the inValues and/or match with the outValues.
    • onValues

      public static Filter onValues(Object[] inValues, Object[] outValues)
      Instantiates a new filter that discards all the clauses that doesn't match with the inValues array and/or match with the outValues array.
      Parameters:
      inValues - A values array that represent the set that must match in order to not discard the clause.
      outValues - A values array that represent the set that must match in order to discard the clause.
      Returns:
      A new filter that discards all the clauses that doesn't match with the inValues array and/or match with the outValues array.
    • take

      public Filter take(Criterion a)
      Creates a new filter with a custom criterion given by input.
      Parameters:
      a - The criterion to set.
      Returns:
      A new filter with a custom criterion given by input.
    • matches

      protected boolean matches(String name, Object value)
    • define

      public Parts define(String name, Object value)
      Description copied from class: Criterion
      defines the Parts of the operation with all the information to become a fragment.
      Specified by:
      define in class Criterion
      Parameters:
      name - the nome of the context field
      value - the current value of the context field
      Returns:
      return null if the Criterion don't find an information, a Parts otherwise. Then Parts con also contain empty strings if the decision is to discard the name and the value
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object