Package org.openhab.core.automation.util
Class ModuleBuilder<B extends ModuleBuilder<B,T>,T extends Module>
java.lang.Object
org.openhab.core.automation.util.ModuleBuilder<B,T>
- Direct Known Subclasses:
ActionBuilder
,ConditionBuilder
,TriggerBuilder
@NonNullByDefault
public abstract class ModuleBuilder<B extends ModuleBuilder<B,T>,T extends Module>
extends Object
This class allows the easy construction of a
Module
instance using the builder pattern.- Author:
- Kai Kreuzer - Initial contribution, Markus Rathgeb - Split implementation for different module types in sub classes
-
Field Summary
Modifier and TypeFieldDescriptionprotected @Nullable Configuration
protected @Nullable String
protected @Nullable String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract T
build()
static <B extends ModuleBuilder<B,
T>, T extends Module>
ModuleBuilder<B, T> static ActionBuilder
static ActionBuilder
createAction
(Action action) static ConditionBuilder
static ConditionBuilder
createCondition
(Condition condition) static TriggerBuilder
static TriggerBuilder
createTrigger
(Trigger trigger) protected String
getId()
protected String
withConfiguration
(Configuration configuration) withDescription
(@Nullable String description) withTypeUID
(String typeUID)
-
Field Details
-
configuration
-
label
-
description
-
-
Constructor Details
-
ModuleBuilder
protected ModuleBuilder() -
ModuleBuilder
-
-
Method Details
-
createAction
-
createAction
-
createCondition
-
createCondition
-
createTrigger
-
createTrigger
-
create
public static <B extends ModuleBuilder<B,T>, ModuleBuilder<B,T extends Module> T> create(Module module) -
withId
-
withTypeUID
-
withConfiguration
-
withLabel
-
withDescription
-
getId
-
getTypeUID
-
build
-