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
Nested ClassesModifier and TypeClassDescriptionstatic final record
Context for rule execution. -
Constructor Summary
ConstructorsConstructorDescriptionRule
(Expression expression, List<String> allowedItemNames) 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
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 calledallowedItemNames
- List of allowed items or empty for disabled.
-
-
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
-