Skip to content

Conditions API

All condition types for controlling property visibility and enabled state.

PropertyCondition

abstract

Class Signature

Constructor Parameters

ParameterTypeRequiredDescription
dependenciesList<String>NoProperty keys this condition depends on

Properties

PropertyTypeDefaultDescription
dependenciesList<String>--Property keys this condition depends on
hasDependenciesbool--True if dependencies is not empty

Methods

  • evaluate
    bool 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

ParameterTypeRequiredDescription
propertyKeyStringYesKey of the property to check
expectedValueTYesValue 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

ParameterTypeRequiredDescription
propertyKeyStringYesKey of the property to check
unexpectedValueTYesValue 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

ParameterTypeRequiredDescription
propertyKeyStringYesKey of the property to check
allowedValuesSet<T>YesAllowed 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

ParameterTypeRequiredDescription
propertyKeyStringYesKey of the property to check
disallowedValuesSet<T>YesDisallowed 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

ParameterTypeRequiredDescription
propertyKeyStringYesKey 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

ParameterTypeRequiredDescription
propertyKeyStringYesKey of the numeric property
compareValueTYesValue to compare against
operatorComparisonOperatorYesComparison 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

ParameterTypeRequiredDescription
conditionsList<PropertyCondition>YesChild 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

ParameterTypeRequiredDescription
conditionsList<PropertyCondition>YesChild 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

ParameterTypeRequiredDescription
conditionPropertyConditionYesThe 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

ParameterTypeRequiredDescription
dependenciesList<String>YesProperty keys this condition depends on
evaluatorbool Function(PropertyCollection)YesCustom evaluation function

Notes

Dependencies are explicitly provided in the constructor. Builder shorthand: PropertyCollectionBuilder.whenCustom(dependencies:, evaluator:).

Uses a function for evaluation.

Next Steps