Module is.codion.common.model
Package is.codion.common.model.table
Interface ColumnConditionModel<C,T>
- Type Parameters:
C
- the type used to identify columnsT
- the column value type
- All Known Implementing Classes:
ForeignKeyConditionModel
,SwingForeignKeyConditionModel
public interface ColumnConditionModel<C,T>
Specifies a condition model based on a table column, parameters, operator, upper bound and lower bound,
as well as relevant events and states.
For instances create a
ColumnConditionModel.Builder
via builder(Object, Class)
.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
The possible automatic wildcard typesstatic interface
Builds aColumnConditionModel
instance.static interface
Responsible for creatingColumnConditionModel
instances. -
Field Summary
Modifier and TypeFieldDescriptionstatic final PropertyValue<ColumnConditionModel.AutomaticWildcard>
Specifies whether wildcards are automatically added to string conditions by default
Value type:ColumnConditionModel.AutomaticWildcard
Default value:ColumnConditionModel.AutomaticWildcard.POSTFIX
static final PropertyValue<Boolean>
Specifies whether string based conditions are case-sensitive or not by default
Value type: Boolean
Default value: false -
Method Summary
Modifier and TypeMethodDescriptionboolean
accepts
(Comparable<T> columnValue) Returns true if the given value is accepted by this models condition.Note that this is only applicable to string based condition models and only used for operatorsOperator.EQUAL
andOperator.NOT_EQUAL
static <C,
T> ColumnConditionModel.Builder<C, T> Returns a newColumnConditionModel.Builder
instance.void
clear()
Clears this condition model, that is, sets all bounds to null and the operator to the first of the ones available.enabled()
format()
inValues()
locked()
operator()
void
setEqualValue
(T value) Sets the values used when theOperator.EQUAL
is enabled.void
setInValues
(Collection<T> values) void
setLowerBound
(T value) void
setUpperBound
(T upper) char
wildcard()
-
Field Details
-
AUTOMATIC_WILDCARD
Specifies whether wildcards are automatically added to string conditions by default
Value type:ColumnConditionModel.AutomaticWildcard
Default value:ColumnConditionModel.AutomaticWildcard.POSTFIX
-
CASE_SENSITIVE
Specifies whether string based conditions are case-sensitive or not by default
Value type: Boolean
Default value: false
-
-
Method Details
-
columnIdentifier
C columnIdentifier()- Returns:
- the column identifier
-
caseSensitive
State caseSensitive()- Returns:
- the State controlling whether this model is case-sensitive, when working with strings
-
format
- Returns:
- the Format object to use when formatting input, an empty Optional in case none is available
-
dateTimePattern
String dateTimePattern()- Returns:
- the date/time format pattern, if any
-
automaticWildcard
Value<ColumnConditionModel.AutomaticWildcard> automaticWildcard()Note that this is only applicable to string based condition models and only used for operatorsOperator.EQUAL
andOperator.NOT_EQUAL
- Returns:
- the Value controlling whether automatic wildcards are enabled when working with strings
-
autoEnable
State autoEnable()- Returns:
- the
State
controlling whether this model is enabled automatically when a condition value is specified
-
locked
State locked()- Returns:
- the state controlling the locked status
-
columnClass
- Returns:
- the column class this condition model is based on
-
setEqualValue
Sets the values used when theOperator.EQUAL
is enabled.- Parameters:
value
- the value to use as condition
-
getEqualValue
T getEqualValue()- Returns:
- the equal value, possibly null
-
setInValues
- Parameters:
values
- the values to set, an empty Collection for none
-
getInValues
Collection<T> getInValues()- Returns:
- the in values, never null
-
setUpperBound
- Parameters:
upper
- the new upper bound
-
getUpperBound
T getUpperBound()- Returns:
- the upper bound
-
setLowerBound
- Parameters:
value
- the lower bound
-
getLowerBound
T getLowerBound()- Returns:
- the lower bound
-
operators
- Returns:
- the operators available in this condition model
-
wildcard
char wildcard()- Returns:
- the character used as a wildcard when working with strings
-
enabled
State enabled()- Returns:
- a state controlling the enabled status
-
clear
void clear()Clears this condition model, that is, sets all bounds to null and the operator to the first of the ones available.- See Also:
-
equalValue
- Returns:
- a Value based on the equal value of this condition model
-
inValues
- Returns:
- a ValueSet based on the in values of this condition model
-
upperBoundValue
- Returns:
- a Value based on the upper bound value of this condition model
-
lowerBoundValue
- Returns:
- a Value based on the lower bound value of this condition model
-
operator
- Returns:
- a Value based on the operator
-
accepts
Returns true if the given value is accepted by this models condition.- Parameters:
columnValue
- the column value- Returns:
- true if the given value is accepted by this models condition
-
conditionChangedEvent
EventObserver<?> conditionChangedEvent()- Returns:
- an observer notified each time the condition state changes
-
builder
Returns a newColumnConditionModel.Builder
instance.- Type Parameters:
C
- the column identifier typeT
- the column value type- Parameters:
columnIdentifier
- the column identifiercolumnClass
- the column class- Returns:
- a new
ColumnConditionModel.Builder
instance
-