Interface CpoWhere

All Known Implementing Classes:
BindableCpoWhere, JdbcCpoWhere

public interface CpoWhere
`CpoWhere` is an interface for specifying the where clause to filter objects that are returned from the Datasource.

A `CpoWhere` node is either a *leaf*, comparing an attribute to a value or another attribute, or a *branch*, formed by chaining leaves/branches together with addWhere(CpoWhere) and a Logical operator. Use isLeaf() to tell which kind a given instance is.

Author:
david berry
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Chains another where clause onto this one, joined by this instance's Logical operator, turning this instance into a branch node.
    Gets the name of the bean attribute on the left-hand side of the comparison.
    Gets the native datastore function applied to the left-hand attribute before comparison.
    Gets the Comparison operator used to compare the attribute against the value or right-hand attribute.
    Gets the Logical operator used to join this where clause with the next one added via addWhere(CpoWhere).
    Gets a string representing the name of this instance of the CpoOrderBy
    boolean
    Gets whether this where clause's comparison result is negated.
    Gets the name of the bean attribute to compare against, when comparing two attributes rather than an attribute and a literal value.
    Gets the native datastore function applied to the right-hand attribute before comparison.
    Gets the literal, unescaped value used in place of a bound comparison value.
    Gets the literal value the attribute is compared against.
    Gets the native datastore function applied to the comparison value before comparison.
    boolean
    Gets whether this instance is a leaf node (a single comparison) rather than a branch node formed by addWhere(CpoWhere).
    void
    Sets the name of the bean attribute on the left-hand side of the comparison.
    void
    Sets a native datastore function (e.g.
    void
    Sets the Comparison operator (e.g. equals, greater-than) used to compare the attribute against the value or right-hand attribute.
    void
    Sets the Logical operator (e.g.
    void
    Sets a string representing the name of this instance of the CpoOrderBy
    void
    setNot(boolean b)
    Sets whether this where clause's comparison result should be negated.
    void
    Sets the name of the bean attribute to compare against, when comparing two attributes rather than an attribute and a literal value.
    void
    Sets a native datastore function (e.g.
    void
    setStaticValue(String staticValue)
    Sets a literal, unescaped value to use in place of a bound comparison value, inserted directly into the native expression.
    void
    Sets the literal value to compare the attribute against.
    void
    Sets a native datastore function (e.g.
  • Method Details

    • setComparison

      void setComparison(Comparison comparison)
      Sets the Comparison operator (e.g. equals, greater-than) used to compare the attribute against the value or right-hand attribute.
      Parameters:
      comparison - the comparison operator for this where clause
    • getComparison

      Comparison getComparison()
      Gets the Comparison operator used to compare the attribute against the value or right-hand attribute.
      Returns:
      the comparison operator for this where clause
    • setLogical

      void setLogical(Logical logical)
      Sets the Logical operator (e.g. AND, OR) used to join this where clause with the next one added via addWhere(CpoWhere).
      Parameters:
      logical - the logical operator joining this clause to the next
    • getLogical

      Logical getLogical()
      Gets the Logical operator used to join this where clause with the next one added via addWhere(CpoWhere).
      Returns:
      the logical operator joining this clause to the next
    • setAttribute

      void setAttribute(String attr)
      Sets the name of the bean attribute on the left-hand side of the comparison.
      Parameters:
      attr - the attribute name
    • getAttribute

      String getAttribute()
      Gets the name of the bean attribute on the left-hand side of the comparison.
      Returns:
      the attribute name
    • setRightAttribute

      void setRightAttribute(String attr)
      Sets the name of the bean attribute to compare against, when comparing two attributes rather than an attribute and a literal value.
      Parameters:
      attr - the right-hand attribute name
    • getRightAttribute

      String getRightAttribute()
      Gets the name of the bean attribute to compare against, when comparing two attributes rather than an attribute and a literal value.
      Returns:
      the right-hand attribute name
    • setValue

      void setValue(Object val)
      Sets the literal value to compare the attribute against.
      Parameters:
      val - the comparison value
    • getValue

      Object getValue()
      Gets the literal value the attribute is compared against.
      Returns:
      the comparison value
    • getNot

      boolean getNot()
      Gets whether this where clause's comparison result is negated.
      Returns:
      `true` if the comparison is negated (NOT), `false` otherwise
    • setNot

      void setNot(boolean b)
      Sets whether this where clause's comparison result should be negated.
      Parameters:
      b - `true` to negate the comparison (NOT), `false` otherwise
    • addWhere

      void addWhere(CpoWhere cw) throws CpoException
      Chains another where clause onto this one, joined by this instance's Logical operator, turning this instance into a branch node.
      Parameters:
      cw - the where clause to add
      Throws:
      CpoException - if the where clause cannot be added
    • setAttributeFunction

      void setAttributeFunction(String s)
      Sets a native datastore function (e.g. `UPPER`) to apply to the left-hand attribute before comparison.
      Parameters:
      s - the function expression to apply to the attribute
    • getAttributeFunction

      String getAttributeFunction()
      Gets the native datastore function applied to the left-hand attribute before comparison.
      Returns:
      the function expression applied to the attribute
    • setValueFunction

      void setValueFunction(String s)
      Sets a native datastore function (e.g. `UPPER`) to apply to the comparison value before comparison.
      Parameters:
      s - the function expression to apply to the value
    • getValueFunction

      String getValueFunction()
      Gets the native datastore function applied to the comparison value before comparison.
      Returns:
      the function expression applied to the value
    • setRightAttributeFunction

      void setRightAttributeFunction(String s)
      Sets a native datastore function (e.g. `UPPER`) to apply to the right-hand attribute before comparison.
      Parameters:
      s - the function expression to apply to the right-hand attribute
    • getRightAttributeFunction

      String getRightAttributeFunction()
      Gets the native datastore function applied to the right-hand attribute before comparison.
      Returns:
      the function expression applied to the right-hand attribute
    • setStaticValue

      void setStaticValue(String staticValue)
      Sets a literal, unescaped value to use in place of a bound comparison value, inserted directly into the native expression.
      Parameters:
      staticValue - the static (literal) value text
    • getStaticValue

      String getStaticValue()
      Gets the literal, unescaped value used in place of a bound comparison value.
      Returns:
      the static (literal) value text
    • isLeaf

      boolean isLeaf()
      Gets whether this instance is a leaf node (a single comparison) rather than a branch node formed by addWhere(CpoWhere).
      Returns:
      `true` if this is a leaf comparison node, `false` if it is a branch
    • getName

      String getName()
      Gets a string representing the name of this instance of the CpoOrderBy
      Returns:
      String The name of the CpoOrderBy
    • setName

      void setName(String s)
      Sets a string representing the name of this instance of the CpoOrderBy
      Parameters:
      s - The name of the CpoOrderBy