Class ProfileTypeBuilder<T extends ProfileType>

java.lang.Object
org.openhab.core.thing.profiles.ProfileTypeBuilder<T>
Type Parameters:
T - the concrete ProfileType sub-interface.

@NonNullByDefault public final class ProfileTypeBuilder<@NonNull T extends ProfileType> extends Object
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 Details

    • newState

      public static ProfileTypeBuilder<StateProfileType> newState(ProfileTypeUID profileTypeUID, String label)
      Obtain a new builder for a StateProfileType instance.
      Parameters:
      profileTypeUID - the ProfileTypeUID
      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 a TriggerProfileType instance.
      Parameters:
      profileTypeUID - the ProfileTypeUID
      label - a human-readable label
      Returns:
      the new builder instance
    • withSupportedItemTypes

      public ProfileTypeBuilder<T> withSupportedItemTypes(String... itemType)
      Declare that the given item type(s) are supported by a profile of this type.
      Parameters:
      itemType -
      Returns:
      the builder itself
    • withSupportedItemTypes

      public ProfileTypeBuilder<T> withSupportedItemTypes(Collection<String> itemTypes)
      Declare that the given item type(s) are supported by a profile of this type.
      Parameters:
      itemTypes -
      Returns:
      the builder itself
    • withSupportedChannelTypeUIDs

      public ProfileTypeBuilder<T> withSupportedChannelTypeUIDs(ChannelTypeUID... channelTypeUIDs)
      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

      public ProfileTypeBuilder<T> withSupportedItemTypesOfChannel(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
    • 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

      public T build()
      Create a profile type instance with the previously given parameters.
      Returns:
      the according subtype of ProfileType