public final class LayoutRulePipeline extends Object
LayoutRules applied in sequence to a
LayoutContext.
Each rule is applied in registration order; before invoking a rule the
pipeline sets the context's active priority to that rule's
LayoutRule.priority(), so the rule's requested writes are mediated by
the LayoutConflictResolver. A rule that throws is logged and skipped
(the pipeline never propagates a rule failure — fault tolerance), and later
rules still run.
With zero registered rules, run(LayoutContext) leaves every
LayoutDecision LayoutDecision.UNSET — the identity pass.
Plan reference: §7.3/S23, §7.4/S23.
| Constructor and Description |
|---|
LayoutRulePipeline() |
| Modifier and Type | Method and Description |
|---|---|
List<LayoutRule> |
getRules()
Read-only view of the registered rules, in registration order.
|
LayoutRulePipeline |
register(LayoutRule rule)
Register a rule.
|
LayoutContext |
run(LayoutContext context)
Apply every registered rule to
context, in order. |
public LayoutRulePipeline()
public LayoutRulePipeline register(LayoutRule rule)
this for chaining.public List<LayoutRule> getRules()
public LayoutContext run(LayoutContext context)
context, in order. Never throws for
a non-null context; a rule that throws is logged and skipped.context - the layout context; must not be nullNullPointerException - if context is null