Klasse Criterion

java.lang.Object
org.apache.torque.criteria.Criterion
Alle implementierten Schnittstellen:
Serializable

public class Criterion extends Object implements Serializable
Describes one or more where clause parts in the Criteria. Either the parts list is not null and represents this criterion or the column, value, comparison and ignoreStringCase columns are not null and represent this criterion.
Siehe auch:
  • Felddetails

  • Konstruktordetails

    • Criterion

      public Criterion(Object lValue, Object rValue, SqlEnum comparison, String sql, Object[] preparedStatementReplacements)
      Create a new instance. Either this Criterion represents a comparison without verbatim SQL; in this case the parameters lValue and comparison must be not null, rValue may be not null and sql and preparedStatementReplacements must be null; or it represents a verbatim sql condition, in which case the parameter comparison must be null and the sql must be not null (preparedStatementReplacements may be set to contain sql placeholder replacement values, and lValue and rValue can be set to add columns to the automatically computed from clause of the query).
      Parameter:
      lValue - the left hand side value of the comparison. If this value should be a value from the database, the object must implement the org.apache.torque.Column interface.
      rValue - the right hand side value of the comparison. If this value should be a value from the database, the object must implement the org.apache.torque.Column interface.
      comparison - The comparison operator. Either this parameter or sql must be not null.
      sql - a verbatim sql condition. Either this parameter or comparison must be not null.
      preparedStatementReplacements - Values for the placeholders in the verbatim sql condition.
      Löst aus:
      NullPointerException - if column is null.
    • Criterion

      public Criterion(Object lValue, Object rValue)
      Create a new instance without verbatim sql, using equals as comparison operator.
      Parameter:
      lValue - the left hand side value of the comparison, not null. If this value should be a value from the database, the object must implement the org.apache.torque.Column interface.
      rValue - the right hand side value of the comparison. If this value should be a value from the database, the object must implement the org.apache.torque.Column interface.
    • Criterion

      public Criterion(Object lValue, SqlEnum comparison)
      Create a new instance without verbatim sql, using a comparison operator without the need for a right value (like SqlEnum.ISNULL, SqlEnum.ISNOTNULL, etc.)
      Parameter:
      lValue - the left hand side value of the comparison, not null. If this value should be a value from the database, the object must implement the org.apache.torque.Column interface.
      comparison - the comparison operator, not null. If the comparison operator needs 2 values, the second value will always be null.
    • Criterion

      public Criterion(Object lValue, Object rValue, SqlEnum comparison)
      Create a new instance without verbatim sql.
      Parameter:
      lValue - the left hand side value of the comparison, not null. If this value should be a value from the database, the object must implement the org.apache.torque.Column interface.
      rValue - the right hand side value of the comparison. If this value should be a value from the database, the object must implement the org.apache.torque.Column interface.
      comparison - the comparison operator, not null.
    • Criterion

      public Criterion(Criterion toCopy)
      Creates a shallow copy of the given Criterion.
      Parameter:
      toCopy - the Criterion to copy from, not null.
  • Methodendetails

    • getLValue

      public Object getLValue()
      Get the left hand side value of the comparison.
      Gibt zurück:
      the left hand side value of the comparison. If this value is a value computed by the database, the object implements the org.apache.torque.Column interface.
    • setLValue

      public void setLValue(Object lValue)
      Set the left hand side value of the comparison.
      Parameter:
      lValue - the left hand side value of the comparison. If this value is a value computed by the database, the object must implement the org.apache.torque.Column interface.
    • getComparison

      public SqlEnum getComparison()
      Get the comparison.
      Gibt zurück:
      A String with the comparison, or null if this Criterion represents a verbatim sql condition.
    • getRValue

      public Object getRValue()
      Get the right hand side value of the comparison.
      Gibt zurück:
      the right hand side value of the comparison. If this value is a value computed by the database, the object implements the org.apache.torque.Column interface.
    • setRValue

      public void setRValue(Object rValue)
      Set the right hand side value of the comparison.
      Parameter:
      rValue - the right hand side value of the comparison. If this value is a value computed by the database, the object must implement the org.apache.torque.Column interface.
    • getSql

      public String getSql()
      Returns the verbatim sql for this condition.
      Gibt zurück:
      the verbatim sql for this condition, or null if this Criterion does not represent a verbatim sql condition.
    • getPreparedStatementReplacements

      public Object[] getPreparedStatementReplacements()
      Returns the prepared statement replacements for a verbatim sql condition.
      Gibt zurück:
      the replacement values, or null.
    • isVerbatimSqlCondition

      public boolean isVerbatimSqlCondition()
      Returns whether this Criterion represents a verbatim sql condition.
      Gibt zurück:
      true if this Criterion represents a verbatim sql condition, false if the sql is computed from lValue, comparison and rValue.
    • setIgnoreCase

      public Criterion setIgnoreCase(boolean b)
      Sets ignore case. ignoreCase is ignored for a verbatim sql statement.
      Parameter:
      b - True if case should be ignored.
      Gibt zurück:
      A modified Criterion object.
    • isIgnoreCase

      public boolean isIgnoreCase()
      Is ignore case on or off?
      Gibt zurück:
      True if case is ignored.
    • getParts

      public List<Criterion> getParts()
      Returns the parts of which this criterion consists.
      Gibt zurück:
      an unmodifiable list of the clauses, or null if this criterion is not a composite criterion.
    • getConjunction

      public String getConjunction()
      Returns the conjunction for the parts of this criterion
      Gibt zurück:
      the conjunction, or null if this criterion is not a composite criterion.
    • isComposite

      public boolean isComposite()
      Returns whether this criterion is a composite criterion.
      Gibt zurück:
      true if this criterion is a composite criterion, false if it represents a single condition.
    • and

      public Criterion and(Criterion criterion)
      Replaces this criterion's condition with (this criterion's condition AND criterion).
      Parameter:
      criterion - the criterion to and with this criterion, not null.
      Gibt zurück:
      the modified Criteria object.
    • or

      public Criterion or(Criterion criterion)
      Replaces this criterion's condition with (this criterion's condition OR criterion).
      Parameter:
      criterion - the criterion to and with this criterion, not null.
      Gibt zurück:
      the modified Criteria object.
    • appendTo

      public void appendTo(StringBuilder sb)
      Appends a debug String representation of the Criterion onto the String builder.
      Parameter:
      sb - the string representation
    • toString

      public String toString()
      Build a string representation of the Criterion for debug purposes.
      Setzt außer Kraft:
      toString in Klasse Object
      Gibt zurück:
      A String with the representation of the Criterion.
    • equals

      public boolean equals(Object obj)
      Setzt außer Kraft:
      equals in Klasse Object
    • hashCode

      public int hashCode()
      Setzt außer Kraft:
      hashCode in Klasse Object