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 Classes
    Modifier and Type
    Interface
    Description
    static final record 
    A boolean combination of two constraints.
    static final record 
    A leaf: the implicit subject value compared against a literal via operator (default ==; != normalised to <>, matching phase 3 / IR lowering).
  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    static String
    THE rendering of a constraint back to its EK9 source form — >= 16 and <= 100.
  • Method Details

    • render

      static String render(ConstraintExpr expr)
      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 Combination is parenthesised only where it is nested, so a top-level and-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