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
Modifier and TypeInterfaceDescriptionstatic interface
A condition specifying all entities of a given type, a no-condition.static interface
An 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 Condition
all
(EntityType entityType) static Condition.Combination
Returns a newCondition.Combination
instance, combining the given condition with AND.static Condition.Combination
and
(Collection<Condition> conditions) Returns a newCondition.Combination
instance, combining the given conditions with AND.columns()
static Condition.Combination
combination
(Conjunction conjunction, Condition... conditions) Initializes a newCondition.Combination
instancestatic Condition.Combination
combination
(Conjunction conjunction, Collection<Condition> conditions) Initializes a newCondition.Combination
instancestatic CustomCondition
custom
(ConditionType conditionType) Creates a newCustomCondition
based on the condition of the given typestatic CustomCondition
Creates a newCustomCondition
based on the condition of the given typestatic Condition
key
(Entity.Key key) Creates aCondition
based on the given keystatic Condition
keys
(Collection<Entity.Key> keys) Creates aCondition
based on the given keys.static Condition.Combination
Returns a newCondition.Combination
instance, combining the given condition with OR.static Condition.Combination
or
(Collection<Condition> conditions) Returns a newCondition.Combination
instance, 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 aCondition
based on the given key- Parameters:
key
- the key- Returns:
- a condition based on the given key
-
keys
Creates aCondition
based on the given keys.- Parameters:
keys
- the keys- Returns:
- a condition based on the given keys
- Throws:
IllegalArgumentException
- in casekeys
is empty or if it contains keys from multiple entity types
-
and
Returns a newCondition.Combination
instance, combining the given condition with AND.- Parameters:
conditions
- the conditions to combine- Returns:
- a new conditions combination
-
and
Returns a newCondition.Combination
instance, combining the given conditions with AND.- Parameters:
conditions
- the conditions to combine- Returns:
- a new conditions combination
-
or
Returns a newCondition.Combination
instance, combining the given condition with OR.- Parameters:
conditions
- the conditions to combine- Returns:
- a new conditions combination
-
or
Returns a newCondition.Combination
instance, combining the given conditions with OR.- Parameters:
conditions
- the conditions to combine- Returns:
- a new conditions combination
-
combination
Initializes a newCondition.Combination
instance- Parameters:
conjunction
- the Conjunction to useconditions
- the conditions to combine- Returns:
- a new
Condition.Combination
instance - Throws:
IllegalArgumentException
- in caseconditions
is empty
-
combination
Initializes a newCondition.Combination
instance- Parameters:
conjunction
- the Conjunction to useconditions
- the conditions to combine- Returns:
- a new
Condition.Combination
instance - Throws:
IllegalArgumentException
- in caseconditions
is empty
-
custom
Creates a newCustomCondition
based on the condition of the given type- Parameters:
conditionType
- the condition type- Returns:
- a new
CustomCondition
instance - 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 newCustomCondition
based 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
CustomCondition
instance - Throws:
NullPointerException
- in case any of the parameters are null- See Also:
-