All Known Subinterfaces:
ColumnCondition<T>, Condition.All, Condition.Combination, CustomCondition, ForeignKeyCondition
All Known Implementing Classes:
AbstractCondition

public interface Condition

Specifies a query condition.

Condition.All indicates no condition, as in, all entities should be returned.
See Also:
  • Method Details

    • entityType

      EntityType entityType()
      Returns:
      the entity type
    • values

      List<?> values()
      Returns:
      a list of the values this condition is based on, in the order they appear in the condition clause. An empty list is returned in case no values are specified.
    • columns

      List<Column<?>> columns()
      Returns:
      a list of the columns this condition is based on, in the same order as their respective values appear in the condition clause. An empty list is returned in case no values are specified.
    • toString

      String toString(EntityDefinition definition)
      Returns a string representing this condition, e.g. "column = ?" or "col1 is not null and col2 in (?, ?)".
      Parameters:
      definition - the entity definition
      Returns:
      a condition string
    • all

      static Condition all(EntityType entityType)
      Parameters:
      entityType - the entity type
      Returns:
      a Condition specifying all entities of the given type
    • key

      static Condition key(Entity.Key key)
      Creates a Condition based on the given key
      Parameters:
      key - the key
      Returns:
      a condition based on the given key
    • keys

      static Condition keys(Collection<Entity.Key> keys)
      Creates a Condition based on the given keys.
      Parameters:
      keys - the keys
      Returns:
      a condition based on the given keys
      Throws:
      IllegalArgumentException - in case keys is empty or if it contains keys from multiple entity types
    • and

      static Condition.Combination and(Condition... conditions)
      Returns a new Condition.Combination instance, combining the given conditions using the AND conjunction.
      Parameters:
      conditions - the conditions to combine
      Returns:
      a new conditions combination
    • and

      static Condition.Combination and(Collection<Condition> conditions)
      Returns a new Condition.Combination instance, combining the given conditions using the AND conjunction.
      Parameters:
      conditions - the conditions to combine
      Returns:
      a new conditions combination
    • or

      static Condition.Combination or(Condition... conditions)
      Returns a new Condition.Combination instance, combining the given conditions using the OR conjunction.
      Parameters:
      conditions - the conditions to combine
      Returns:
      a new conditions combination
    • or

      static Condition.Combination or(Collection<Condition> conditions)
      Returns a new Condition.Combination instance, combining the given conditions using the OR conjunction.
      Parameters:
      conditions - the conditions to combine
      Returns:
      a new conditions combination
    • combination

      static Condition.Combination combination(Conjunction conjunction, Condition... conditions)
      Initializes a new Condition.Combination instance
      Parameters:
      conjunction - the Conjunction to use
      conditions - the conditions to combine
      Returns:
      a new Condition.Combination instance
      Throws:
      IllegalArgumentException - in case conditions is empty
    • combination

      static Condition.Combination combination(Conjunction conjunction, Collection<Condition> conditions)
      Initializes a new Condition.Combination instance
      Parameters:
      conjunction - the Conjunction to use
      conditions - the conditions to combine
      Returns:
      a new Condition.Combination instance
      Throws:
      IllegalArgumentException - in case conditions is empty