Class Condition

All Implemented Interfaces:
Archivable, RMJSONArchiver.GetKeys, RMPropertyChanger, Cloneable
Direct Known Subclasses:
ConditionList

public class Condition extends RMObject implements RMJSONArchiver.GetKeys, Archivable
Represents a condition that is part of a SQL where clause.
  • Field Details

  • Constructor Details

    • Condition

      public Condition()
      Creates a new select condition.
    • Condition

      public Condition(String aPropertyName, Condition.Operator anOperator, Object aValue)
      Creates a new select condition.
  • Method Details

    • getPropertyName

      public String getPropertyName()
      Returns the property name.
    • setPropertyName

      public void setPropertyName(String aValue)
      Sets the property name.
    • getOperator

      public Condition.Operator getOperator()
      Returns the operator.
    • setOperator

      public void setOperator(Condition.Operator anOperator)
      Sets the operator.
    • getValue

      public Object getValue()
      Returns the value.
    • setValue

      public void setValue(Object aValue)
      Sets the value.
    • isNegated

      public boolean isNegated()
      Returns whether condition is negated.
    • setNegated

      public void setNegated(boolean aValue)
      Sets whether condition is negated.
    • getIgnoreCase

      public boolean getIgnoreCase()
      Returns whether condition ignores case (string types).
    • setIgnoreCase

      public void setIgnoreCase(boolean aValue)
      Sets whether condition ignores case (string types).
    • getDateConstraint

      public Condition.DateConstraint getDateConstraint()
      Returns date constraint.
    • setDateConstraint

      public void setDateConstraint(Condition.DateConstraint aDateConstraint)
      Sets the date constraint.
    • getDateConstraintDefault

      public Condition.DateConstraint getDateConstraintDefault()
      Returns the date constraint default.
    • getDateConstraintMultiplier

      public long getDateConstraintMultiplier()
      Returns the date constraint multiplier.
    • getOperators

      public static List<Condition.Operator> getOperators(Property.Type aType)
      Returns the valid operators for a given property type.
    • getValue

      public boolean getValue(@Nonnull Entity anEntity, Object anObj)
      Returns the value of evaluating this condition on given object.
    • equals

      public boolean equals(Object anObj)
      Standard equals implementation.
      Overrides:
      equals in class Object
    • clone

      public Condition clone()
      Standard clone implementation (to get co-variant return type).
      Overrides:
      clone in class RMListenerList
    • toXML

      public RXElement toXML(RXArchiver anArchiver)
      XML Archival.
      Specified by:
      toXML in interface Archivable
    • fromXML

      public Condition fromXML(RXArchiver anArchiver, RXElement anElement)
      XML Unarchival.
      Specified by:
      fromXML in interface Archivable
    • getJSONKeys

      public List<String> getJSONKeys()
      RMJSONArchiver.GetKeys method.
      Specified by:
      getJSONKeys in interface RMJSONArchiver.GetKeys
    • toString

      public String toString()
      Returns a string for condition.
      Overrides:
      toString in class RMObject