Class VisibilityRule
Rules hide UI; they never authorize. The endpoint behind a hidden action must still check the caller.
Use visible(false) instead when the element must not reach the client at all.
The evaluation map depends on the element's level. A row action, detail field or region sees the row plus the
page's facts under a facts. prefix; a card, badge or ribbon item sees the page's top-level
facts alone. A field absent from the map fails closed for every operator except absent.
Example:
RowAction.
- Since:
- 10.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classFluent operator picker returned bywhen(String). -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanEvaluates a list of rules against an evaluation map; every rule must match (AND).toMap()Serializes this rule to its wire shape.static VisibilityRule.BuilderStarts a rule for the given field.
-
Field Details
-
field
The field this rule tests, a dotted path into the evaluation map (e.g."facts.viewer.roles"). -
op
The wire token of the comparison operator (seeOp.wire()). -
value
The comparison value foreq/ne/in/contains; omitted forpresent/absent.
-
-
Method Details
-
when
Starts a rule for the given field.- Parameters:
field- The dotted-path field to test. Must not benull or blank.- Returns:
- A
VisibilityRule.Builderto pick the operator. - Throws:
IllegalArgumentException- Iffieldisnull or blank.
-
test
Evaluates a list of rules against an evaluation map; every rule must match (AND).A
null or empty list always matches. A field absent frommapnever satisfieseq/ne/in/contains/present; onlyabsenttreats a missing field as a match. Mirrors the JSJuneauViews.rules.testevaluator exactly.- Parameters:
rules- The rules to test, ornull .map- The evaluation map.- Returns:
true when every rule matches.- Throws:
IllegalArgumentException- If a rule'sopis not one of the known tokens.
-
toMap
Serializes this rule to its wire shape.- Returns:
- An ordered
Mapoffield,opand (when set)value.
-