Record Class ConditionGroupSpec

java.lang.Object
java.lang.Record
org.litebridge.orm.api.select.model.ConditionGroupSpec
Record Components:
conditions - A list of conditions to be combined.
subgroups - A list of subgroups of conditions to be combined.

public record ConditionGroupSpec(List<LogicConditionSpec> conditions, List<LogicConditionGroupSpec> subgroups) extends Record
Groups conditions and condition subgroups using a logical operator.
  • Constructor Details

    • ConditionGroupSpec

      public ConditionGroupSpec(List<LogicConditionSpec> conditions, List<LogicConditionGroupSpec> subgroups)
      Constructs a ConditionGroupSpec with the specified conditions and subgroups.
      Parameters:
      conditions - the list of logic condition specifications
      subgroups - the list of logic condition group specifications
    • ConditionGroupSpec

      public ConditionGroupSpec(List<LogicConditionSpec> conditions)
      Constructs a ConditionGroupSpec with the specified conditions.
      Parameters:
      conditions - the list of logic condition specifications
    • ConditionGroupSpec

      public ConditionGroupSpec()
      Constructs an empty ConditionGroupSpec.
  • Method Details

    • newCondition

      public ConditionSpec newCondition(LogicOperator logicOperator, ExpressionSpec expressionSpec)
      Adds a new condition to the group and returns its specification.
      Parameters:
      logicOperator - the logic operator for the condition
      expressionSpec - the expression specification for the condition
      Returns:
      the newly created ConditionSpec
    • newSubgroup

      public LogicConditionGroupSpec newSubgroup(LogicOperator logicOperator)
      Adds a new subgroup to the group and returns its specification.
      Parameters:
      logicOperator - the logic operator for the subgroup
      Returns:
      the newly created LogicConditionGroupSpec
    • toConditionGroup

      public ConditionGroup toConditionGroup(SelectExpressionMapper selectExpressionMapper, Set<Table> selectedTables)
      Converts this specification into a ConditionGroup.
      Parameters:
      selectExpressionMapper - the mapper to use for expressions
      selectedTables - the set of tables included in the query
      Returns:
      the resulting ConditionGroup
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • conditions

      public List<LogicConditionSpec> conditions()
      Returns the value of the conditions record component.
      Returns:
      the value of the conditions record component
    • subgroups

      public List<LogicConditionGroupSpec> subgroups()
      Returns the value of the subgroups record component.
      Returns:
      the value of the subgroups record component