Interface ConstraintExpr
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
ConstraintExpr.Combination, ConstraintExpr.Comparison
public sealed interface ConstraintExpr
extends Serializable
permits ConstraintExpr.Comparison, ConstraintExpr.Combination
A serializable model of a constrained-type constraint, captured in phase 3 and stored on the
constrained
AggregateSymbol so later phases (and module-cache reloads) can evaluate it
without the original parse tree.
Mirrors the constrainType grammar exactly:
constrainType
: op=(GT|GE|LT|LE|EQUAL|NOTEQUAL|NOTEQUAL2|MATCHES|CONTAINS)? literal // ConstraintExpr.Comparison
| constrainType op=(AND|OR) constrainType // ConstraintExpr.Combination
| LPAREN constrainType RPAREN // transparent (no node)
Deliberately String-only (operator text, literal text, type FQN) so it serializes cleanly with the owning aggregate for binary module caching.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordA boolean combination of two constraints.static final recordA leaf: the implicit subject value compared against a literal viaoperator(default==;!=normalised to<>, matching phase 3 / IR lowering). -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic Stringrender(ConstraintExpr expr) THE rendering of a constraint back to its EK9 source form —>= 16 and <= 100.
-
Method Details
-
render
THE rendering of a constraint back to its EK9 source form —>= 16 and <= 100.Lives on the model rather than in a consumer so it cannot drift from the shape it renders: the operator, literal text and boolean operator it reads are this file's own components. A
Combinationis parenthesised only where it is nested, so a top-leveland-chain reads the way it was written.- Parameters:
expr- the constraint, may be null- Returns:
- the rendered source, or null when there is no constraint
-