Package org.openhab.core.automation.util
Class RuleBuilder
java.lang.Object
org.openhab.core.automation.util.RuleBuilder
This class allows the easy construction of a
Rule instance using the builder pattern.- Author:
- Kai Kreuzer - Initial contribution
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()static RuleBuilderBuild a newRuleusing the specified rule UID.static RuleBuilderBuild a newRulewith a new UID, based on an existing rule.static RuleBuilderBuild a newRulebased on an existing rule.static RuleBuildercreate(RuleTemplate template, String uid, @Nullable String name, Configuration configuration, Visibility visibility) withActions(@Nullable List<? extends Action> actions) withActions(@Nullable Action... actions) withConditions(@Nullable List<? extends Condition> conditions) withConditions(@Nullable Condition... conditions) withConfiguration(@Nullable Configuration ruleConfiguration) withConfigurationDescriptions(@Nullable List<ConfigDescriptionParameter> configDescs) withDescription(@Nullable String description) withTags(@Nullable Collection<String> tags) withTemplateState(Rule.TemplateState templateState) withTemplateUID(@Nullable String uid) withTriggers(@Nullable List<? extends Trigger> triggers) withTriggers(@Nullable Trigger... triggers) withVisibility(@Nullable Visibility visibility)
-
Constructor Details
-
RuleBuilder
-
-
Method Details
-
create
Build a newRuleusing the specified rule UID.- Parameters:
ruleUid- the UID to use.- Returns:
- The new
RuleBuilder.
-
create
Build a newRulebased on an existing rule.- Parameters:
r- theRuleto base the builder on.- Returns:
- The new
RuleBuilder.
-
create
Build a newRulewith a new UID, based on an existing rule.- Parameters:
ruleUid- the UID to use.r- theRuleto base the builder on.- Returns:
- The new
RuleBuilder.
-
create
public static RuleBuilder create(RuleTemplate template, String uid, @Nullable String name, Configuration configuration, Visibility visibility) Build a newRulefrom the specifiedRuleTemplateandConfiguration. The resulting rule will be ready for template placeholder substitution, but the placeholders won't actually have been substituted. This constructor is only suitable for preparing to substitute placeholders.- Parameters:
template- theRuleTemplateto use.uid- the UID of the resultingRule.name- the name to initialize the builder with.configuration- the configuration to initialize the builder with.visibility- theVisibilityto initialize the builder with.- Returns:
- The new
RuleBuilder.
-
withName
-
withDescription
-
withTemplateUID
-
withTemplateState
-
withVisibility
-
withTriggers
-
withTriggers
-
withConditions
-
withConditions
-
withActions
-
withActions
-
withTags
-
withTags
-
withConfiguration
-
withConfigurationDescriptions
public RuleBuilder withConfigurationDescriptions(@Nullable List<ConfigDescriptionParameter> configDescs) -
build
-