Package ai.confiqure

Annotation Type Confiqure.Gate

Enclosing class:
Confiqure

@Target(FIELD) @Retention(RUNTIME) public static @interface Confiqure.Gate
Declarative flow gate on a single field: the confiqure conversation may only WRITE this field when the requires() predicate is true over the root instance's current values. This turns a sequencing rule that used to live in Javadoc prose ("don't collect the site URL until the legal terms are accepted") into a machine-enforced gate. The model proposes; the engine disposes — a well-behaved model never trips the gate, and a misbehaving one gets a structured, recoverable correction instead of a silent bad write.

Predicate grammar (the same grammar Confiqure.ToolGate.requires() and Confiqure.SectionGate.requires() use). It is evaluated over a flat, dotted-key view of the root instance's current values — a nested field is addressed by its path from the root (e.g. quietHours.enabled). It is safe by construction: no method calls, no arithmetic, no reflection.

 expr       := or
 or         := and ('||' and)*
 and        := unary ('&&' unary)*
 unary      := '!' unary | '(' expr ')' | comparison
 comparison := operand (('=='|'!='|'<'|'<='|'>'|'>=') operand)?   // a bare operand is a truthy boolean test
             | operand 'in' '{' literal (',' literal)* '}'   // membership
 operand    := literal | fieldPath
 literal    := number | 'single-quoted' | "double-quoted" | true | false | null
 fieldPath  := ident ('.' ident)*
 
Semantics: ==/!= compare loosely across String/Boolean/Number (numeric when both sides parse as numbers, else string equality; field == true matches both Boolean.TRUE and the string "true"). &lt; &lt;= &gt; &gt;= apply only when both operands are numeric, otherwise they are false. A missing/unset field is null; any comparison involving null is false EXCEPT x == null (true when missing) and x != null. A bare fieldPath means fieldPath == true.

Examples

 @Confiqure.Gate(requires = "userAcceptedLegalTermsRisks == true",
                 message  = "Please accept the legal terms first — then I can save your site URL.")
 private String siteUrl;

 @Confiqure.Gate(requires = "plan in {'pro', 'enterprise'} && seatCount >= 5")
 private boolean advancedAnalyticsEnabled;
 
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Predicate (grammar above) that must hold over the root instance's current values before this field may be written.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Optional coaching shown to the conversation when the gate blocks a write.
  • Element Details

    • requires

      String requires
      Predicate (grammar above) that must hold over the root instance's current values before this field may be written.
    • message

      String message
      Optional coaching shown to the conversation when the gate blocks a write. Defaults to the predicate text.
      Default:
      ""