Module is.codion.common.model
Package is.codion.common.model.condition
Interface ConditionModel<C,T>
- Type Parameters:
C
- the type used to identify the conditionT
- the condition value type
- All Known Implementing Classes:
ForeignKeyConditionModel
,SwingForeignKeyConditionModel
public interface ConditionModel<C,T>
Specifies a condition with an operator and operands as well as relevant events and states.
For instances create a
ConditionModel.Builder
via builder(Object, Class)
.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
The possible automatic wildcard typesstatic interface
Builds aConditionModel
instance.static interface
Responsible for creatingConditionModel
instances.static interface
Provides access to the operands. -
Field Summary
Modifier and TypeFieldDescriptionstatic final PropertyValue<ConditionModel.AutomaticWildcard>
Specifies whether wildcards are automatically added to string conditions by default Value type:ConditionModel.AutomaticWildcard
Default value:ConditionModel.AutomaticWildcard.POSTFIX
static final PropertyValue<Boolean>
Specifies whether string based conditions are case-sensitive by default Value type: Boolean Default value: false -
Method Summary
Modifier and TypeMethodDescriptionboolean
accepts
(Comparable<T> value) 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> ConditionModel.Builder<C, T> Returns a newConditionModel.Builder
instance.Observer<?>
changed()
void
clear()
Clears this condition model, that is, clears all operands and sets the operator to the initial one.enabled()
format()
locked()
operands()
operator()
-
Field Details
-
AUTOMATIC_WILDCARD
Specifies whether wildcards are automatically added to string conditions by default- Value type:
ConditionModel.AutomaticWildcard
- Default value:
ConditionModel.AutomaticWildcard.POSTFIX
- Value type:
-
CASE_SENSITIVE
Specifies whether string based conditions are case-sensitive by default- Value type: Boolean
- Default value: false
-
-
Method Details
-
identifier
C identifier()- Returns:
- the condition 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<ConditionModel.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
-
valueClass
- Returns:
- the value class this condition model is based on
-
operators
- Returns:
- the operators available in this condition model
-
enabled
State enabled()- Returns:
- a state controlling the enabled status
-
clear
void clear()Clears this condition model, that is, clears all operands and sets the operator to the initial one. -
operator
- Returns:
- a
Value
controlling on the operator
-
operands
ConditionModel.Operands<T> operands()- Returns:
- the operands
-
accepts
Returns true if the given value is accepted by this models condition.- Parameters:
value
- the value- Returns:
- true if the given value is accepted by this models condition
-
changed
Observer<?> changed()- Returns:
- an observer notified each time the condition state changes
-
builder
Returns a newConditionModel.Builder
instance.- Type Parameters:
C
- the condition identifier typeT
- the condition value type- Parameters:
identifier
- the condition identifiervalueClass
- the value class- Returns:
- a new
ConditionModel.Builder
instance
-