Package org.openhab.core.voice.text
Class Rule
java.lang.Object
org.openhab.core.voice.text.Rule
Represents an expression plus action code that will be executed after successful parsing. This class is immutable and
deriving classes should conform to this principle.
- Author:
- Tilman Kamp - Initial contribution
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
Context for rule execution. -
Constructor Summary
ConstructorDescriptionRule
(Expression expression, AbstractRuleBasedInterpreter.ItemFilter itemFilter, boolean isForced, boolean isSilent) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionabstract InterpretationResult
interpretAST
(ResourceBundle language, ASTNode node, Rule.InterpretationContext context) Will get called after the expression was successfully parsed.
-
Constructor Details
-
Rule
public Rule(Expression expression, AbstractRuleBasedInterpreter.ItemFilter itemFilter, boolean isForced, boolean isSilent) Constructs a new instance.- Parameters:
expression
- the expression that has to parse successfully, beforeinterpretAST(java.util.ResourceBundle, org.openhab.core.voice.text.ASTNode, org.openhab.core.voice.text.Rule.InterpretationContext)
is calleditemFilter
- Filters allowed items for rule.isSilent
- Rule will emit no response on success.
-
-
Method Details
-
interpretAST
public abstract InterpretationResult interpretAST(ResourceBundle language, ASTNode node, Rule.InterpretationContext context) Will get called after the expression was successfully parsed.- Parameters:
language
- a resource bundle that can be used for looking up common localized response phrasesnode
- the resulting AST node of the parse run. To be used as input.context
- for rule interpretation- Returns:
-
getExpression
- Returns:
- the expression
-