Conditions API
All condition types for controlling property visibility and enabled state.
PropertyCondition
abstractClass Signature
Constructor Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
dependencies | List<String> | No | Property keys this condition depends on |
Properties
| Property | Type | Default | Description |
|---|---|---|---|
dependencies | List<String> | -- | Property keys this condition depends on |
hasDependencies | bool | -- | True if dependencies is not empty |
Methods
evaluatebool evaluate(PropertyCollection collection)Evaluate the condition against the current collection state.
The base class for all conditions. Subclasses specify their dependencies and implement evaluate().
EqualsCondition
Class Signature
Constructor Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
propertyKey | String | Yes | Key of the property to check |
expectedValue | T | Yes | Value to compare against |
Notes
Dependencies: [propertyKey]. Builder shorthand: PropertyCollectionBuilder.when<T>(key, value).
True when a property equals a specific value.
NotEqualsCondition
Class Signature
Constructor Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
propertyKey | String | Yes | Key of the property to check |
unexpectedValue | T | Yes | Value that should not match |
Notes
Dependencies: [propertyKey]. Builder shorthand: PropertyCollectionBuilder.whenNot<T>(key, value).
True when a property does not equal a specific value.
InCondition
Class Signature
Constructor Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
propertyKey | String | Yes | Key of the property to check |
allowedValues | Set<T> | Yes | Allowed value set |
Notes
Dependencies: [propertyKey]. Builder shorthand: PropertyCollectionBuilder.whenIn<T>(key, values).
True when a property value is in a set of allowed values.
NotInCondition
Class Signature
Constructor Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
propertyKey | String | Yes | Key of the property to check |
disallowedValues | Set<T> | Yes | Disallowed value set |
Notes
Dependencies: [propertyKey]. Builder shorthand: PropertyCollectionBuilder.whenNotIn<T>(key, values).
True when a property value is not in a set of values.
HasValueCondition
Class Signature
Constructor Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
propertyKey | String | Yes | Key of the property to check |
Notes
Dependencies: [propertyKey]. Builder shorthand: PropertyCollectionBuilder.whenHasValue(key).
True when a property exists and has a non-null value.
ComparisonCondition
Class Signature
Constructor Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
propertyKey | String | Yes | Key of the numeric property |
compareValue | T | Yes | Value to compare against |
operator | ComparisonOperator | Yes | Comparison operator |
Notes
Dependencies: [propertyKey]. Builder shorthands: PropertyCollectionBuilder.whenGreaterThan<T>(key, value) and whenLessThan<T>(key, value).
True when a numeric property satisfies a comparison.
AndCondition
Class Signature
Constructor Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conditions | List<PropertyCondition> | Yes | Child conditions — all must be true |
Notes
Dependencies are the union of all child dependencies. Builder shorthand: PropertyCollectionBuilder.whenAll(conditions).
True when all child conditions are true.
OrCondition
Class Signature
Constructor Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conditions | List<PropertyCondition> | Yes | Child conditions — any must be true |
Notes
Dependencies are the union of all child dependencies. Builder shorthand: PropertyCollectionBuilder.whenAny(conditions).
True when any child condition is true.
NotCondition
Class Signature
Constructor Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
condition | PropertyCondition | Yes | The condition to invert |
Notes
Dependencies are the same as the child condition. No builder shorthand — use the constructor directly.
Inverts the result of another condition.
AlwaysTrueCondition
Class Signature
Notes
Always returns true. Useful as a default visibility/enabled condition. No dependencies.
Always returns true. Useful as a default.
AlwaysFalseCondition
Class Signature
Notes
Always returns false. Useful for permanently hiding a property. No dependencies.
Always returns false. Useful for permanently hiding a property.
CustomCondition
Class Signature
Constructor Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
dependencies | List<String> | Yes | Property keys this condition depends on |
evaluator | bool Function(PropertyCollection) | Yes | Custom evaluation function |
Notes
Dependencies are explicitly provided in the constructor. Builder shorthand: PropertyCollectionBuilder.whenCustom(dependencies:, evaluator:).
Uses a function for evaluation.
Next Steps
- Validators API -- Validator reference
- Property<T> API -- Property and control reference
- Conditions Concept -- Conditions in depth