Class ChannelBuilder
java.lang.Object
org.openhab.core.thing.binding.builder.ChannelBuilder
ChannelBuilder
is responsible for creating Channel
s.- Author:
- Dennis Nobel - Initial contribution, Alex Tugarev - Extended about default tags, Chris Jackson - Added properties and label/description
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds and returns theChannel
.static ChannelBuilder
Creates aChannelBuilder
from the givenChannel
.static ChannelBuilder
create
(ChannelUID channelUID) Creates aChannelBuilder
for the givenChannelUID
.static ChannelBuilder
create
(ChannelUID channelUID, @Nullable String acceptedItemType) Creates aChannelBuilder
for the givenChannelUID
and item type.withAcceptedItemType
(@Nullable String acceptedItemType) Sets the accepted item type of theChannel
to be build.withAutoUpdatePolicy
(@Nullable AutoUpdatePolicy policy) Sets theAutoUpdatePolicy
to theChannel
to be build.withConfiguration
(Configuration configuration) Appends aConfiguration
to theChannel
to be build.withDefaultTags
(Set<String> defaultTags) Appends default tags to theChannel
to be build.withDescription
(String description) Sets the channel description.withKind
(ChannelKind kind) Sets theChannelKind
of theChannel
to be build.Sets the channel label.withProperties
(Map<String, String> properties) Adds properties to theChannel
.withType
(@Nullable ChannelTypeUID channelTypeUID)
-
Method Details
-
create
Creates aChannelBuilder
for the givenChannelUID
.- Parameters:
channelUID
- theChannelUID
- Returns:
- channel builder
-
create
Creates aChannelBuilder
for the givenChannelUID
and item type.- Parameters:
channelUID
- theChannelUID
acceptedItemType
- item type that is accepted by this channel- Returns:
- channel builder
-
create
Creates aChannelBuilder
from the givenChannel
.- Parameters:
channel
- the channel to be changed- Returns:
- channel builder
-
withType
- Parameters:
channelTypeUID
- theChannelTypeUID
- Returns:
- channel builder
-
withConfiguration
Appends aConfiguration
to theChannel
to be build.- Parameters:
configuration
- theConfiguration
- Returns:
- channel builder
-
withProperties
Adds properties to theChannel
.- Parameters:
properties
- properties to add- Returns:
- channel builder
-
withLabel
Sets the channel label. This allows overriding of the default label set in theChannelType
.- Parameters:
label
- the channel label to override the label set in theChannelType
- Returns:
- channel builder
-
withDescription
Sets the channel description. This allows overriding of the default description set in theChannelType
.- Parameters:
description
- the channel label to override the description set in theChannelType
- Returns:
- channel builder
-
withDefaultTags
Appends default tags to theChannel
to be build.- Parameters:
defaultTags
- default tags- Returns:
- channel builder
-
withKind
Sets theChannelKind
of theChannel
to be build.- Parameters:
kind
- theChannelKind
- Returns:
- channel builder
-
withAcceptedItemType
Sets the accepted item type of theChannel
to be build. SeeCoreItemFactory.getSupportedItemTypes()
for a list of available item types.- Parameters:
acceptedItemType
- item type that is accepted by this channel- Returns:
- channel builder
-
withAutoUpdatePolicy
Sets theAutoUpdatePolicy
to theChannel
to be build.- Parameters:
policy
- theAutoUpdatePolicy
to be used- Returns:
- channel builder
-
build
Builds and returns theChannel
.- Returns:
- the
Channel
-