Package org.openhab.core.thing.profiles
Class ProfileTypeBuilder<T extends ProfileType>
java.lang.Object
org.openhab.core.thing.profiles.ProfileTypeBuilder<T>
- Type Parameters:
T
- the concreteProfileType
sub-interface.
Builder for
ProfileType
instances.
It can be used to obtain instances instead of implementing any of the interfaces derived from ProfileType
.- Author:
- Simon Kaufmann - Initial contribution
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Create a profile type instance with the previously given parameters.static ProfileTypeBuilder<StateProfileType>
newState
(ProfileTypeUID profileTypeUID, String label) Obtain a new builder for aStateProfileType
instance.static ProfileTypeBuilder<TriggerProfileType>
newTrigger
(ProfileTypeUID profileTypeUID, String label) Obtain a new builder for aTriggerProfileType
instance.withSupportedChannelTypeUIDs
(Collection<ChannelTypeUID> channelTypeUIDs) Declare that the given channel type(s) are supported by a profile of this type.withSupportedChannelTypeUIDs
(ChannelTypeUID... channelTypeUIDs) Declare that the given channel type(s) are supported by a profile of this type.withSupportedItemTypes
(String... itemType) Declare that the given item type(s) are supported by a profile of this type.withSupportedItemTypes
(Collection<String> itemTypes) Declare that the given item type(s) are supported by a profile of this type.withSupportedItemTypesOfChannel
(String... supportedItemTypesOfChannel) Declare that channels with these item type(s) are compatible with profiles of this type.withSupportedItemTypesOfChannel
(Collection<String> supportedItemTypesOfChannel) Declare that channels with these item type(s) are compatible with profiles of this type.
-
Method Details
-
newState
public static ProfileTypeBuilder<StateProfileType> newState(ProfileTypeUID profileTypeUID, String label) Obtain a new builder for aStateProfileType
instance.- Parameters:
profileTypeUID
- theProfileTypeUID
label
- a human-readable label- Returns:
- the new builder instance
-
newTrigger
public static ProfileTypeBuilder<TriggerProfileType> newTrigger(ProfileTypeUID profileTypeUID, String label) Obtain a new builder for aTriggerProfileType
instance.- Parameters:
profileTypeUID
- theProfileTypeUID
label
- a human-readable label- Returns:
- the new builder instance
-
withSupportedItemTypes
Declare that the given item type(s) are supported by a profile of this type.- Parameters:
itemType
-- Returns:
- the builder itself
-
withSupportedItemTypes
Declare that the given item type(s) are supported by a profile of this type.- Parameters:
itemTypes
-- Returns:
- the builder itself
-
withSupportedChannelTypeUIDs
Declare that the given channel type(s) are supported by a profile of this type.- Parameters:
channelTypeUIDs
-- Returns:
- the builder itself
-
withSupportedChannelTypeUIDs
public ProfileTypeBuilder<T> withSupportedChannelTypeUIDs(Collection<ChannelTypeUID> channelTypeUIDs) Declare that the given channel type(s) are supported by a profile of this type.- Parameters:
channelTypeUIDs
-- Returns:
- the builder itself
-
withSupportedItemTypesOfChannel
Declare that channels with these item type(s) are compatible with profiles of this type.- Parameters:
supportedItemTypesOfChannel
- item types on channel to which this profile type is compatible with- Returns:
- the builder itself
-
withSupportedItemTypesOfChannel
public ProfileTypeBuilder<T> withSupportedItemTypesOfChannel(Collection<String> supportedItemTypesOfChannel) Declare that channels with these item type(s) are compatible with profiles of this type.- Parameters:
supportedItemTypesOfChannel
- item types on channel to which this profile type is compatible with- Returns:
- the builder itself
-
build
Create a profile type instance with the previously given parameters.- Returns:
- the according subtype of
ProfileType
-