Module is.codion.framework.domain
Interface Condition
- All Known Subinterfaces:
ColumnCondition<T>,Condition.All,Condition.Combination,CustomCondition,ForeignKeyCondition
- All Known Implementing Classes:
AbstractCondition
public interface Condition
Specifies a query condition.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA condition specifying all entities of a given type, a no-condition.static interfaceAn interface encapsulating a combination of Condition instances, that should be either AND'ed or OR'ed together in a query context -
Method Summary
Modifier and TypeMethodDescriptionstatic Conditionall(EntityType entityType) static Condition.CombinationReturns a newCondition.Combinationinstance, combining the given condition with AND.static Condition.Combinationand(Collection<Condition> conditions) Returns a newCondition.Combinationinstance, combining the given conditions with AND.columns()static Condition.Combinationcombination(is.codion.common.Conjunction conjunction, Condition... conditions) Initializes a newCondition.Combinationinstancestatic Condition.Combinationcombination(is.codion.common.Conjunction conjunction, Collection<Condition> conditions) Initializes a newCondition.Combinationinstancestatic CustomConditioncustom(ConditionType conditionType) Creates a newCustomConditionbased on the condition of the given typestatic CustomConditionCreates a newCustomConditionbased on the condition of the given typestatic Conditionkey(Entity.Key key) Creates aConditionbased on the given keystatic Conditionkeys(Collection<Entity.Key> keys) Creates aConditionbased on the given keys.static Condition.CombinationReturns a newCondition.Combinationinstance, combining the given condition with OR.static Condition.Combinationor(Collection<Condition> conditions) Returns a newCondition.Combinationinstance, combining the given conditions with OR.toString(EntityDefinition definition) Returns a string representing this condition, e.g.List<?>values()
-
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
- 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
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
- Parameters:
entityType- the entity type- Returns:
- a Condition specifying all entities of the given type
-
key
Creates aConditionbased on the given key- Parameters:
key- the key- Returns:
- a condition based on the given key
-
keys
Creates aConditionbased on the given keys.- Parameters:
keys- the keys- Returns:
- a condition based on the given keys
- Throws:
IllegalArgumentException- in casekeysis empty or if it contains keys from multiple entity types
-
and
Returns a newCondition.Combinationinstance, combining the given condition with AND.- Parameters:
conditions- the conditions to combine- Returns:
- a new conditions combination
-
and
Returns a newCondition.Combinationinstance, combining the given conditions with AND.- Parameters:
conditions- the conditions to combine- Returns:
- a new conditions combination
-
or
Returns a newCondition.Combinationinstance, combining the given condition with OR.- Parameters:
conditions- the conditions to combine- Returns:
- a new conditions combination
-
or
Returns a newCondition.Combinationinstance, combining the given conditions with OR.- Parameters:
conditions- the conditions to combine- Returns:
- a new conditions combination
-
combination
static Condition.Combination combination(is.codion.common.Conjunction conjunction, Condition... conditions) Initializes a newCondition.Combinationinstance- Parameters:
conjunction- the Conjunction to useconditions- the conditions to combine- Returns:
- a new
Condition.Combinationinstance - Throws:
IllegalArgumentException- in caseconditionsis empty
-
combination
static Condition.Combination combination(is.codion.common.Conjunction conjunction, Collection<Condition> conditions) Initializes a newCondition.Combinationinstance- Parameters:
conjunction- the Conjunction to useconditions- the conditions to combine- Returns:
- a new
Condition.Combinationinstance - Throws:
IllegalArgumentException- in caseconditionsis empty
-
custom
Creates a newCustomConditionbased on the condition of the given type- Parameters:
conditionType- the condition type- Returns:
- a new
CustomConditioninstance - Throws:
NullPointerException- in case the condition type is null- See Also:
-
custom
static CustomCondition custom(ConditionType conditionType, List<Column<?>> columns, List<Object> values) Creates a newCustomConditionbased on the condition of the given type- Parameters:
conditionType- the condition typecolumns- the columns representing the values used by this condition, in the same order as their respective valuesvalues- the values used by this condition string- Returns:
- a new
CustomConditioninstance - Throws:
NullPointerException- in case any of the parameters are null- See Also:
-