Class ChannelUID


  • @NonNullByDefault
    public class ChannelUID
    extends UID
    ChannelUID represents a unique identifier for channels.
    Author:
    Oliver Libutzki - Initial contribution, Jochen Hiller - Bugfix 455434: added default constructor, Dennis Nobel - Added channel group id, Kai Kreuzer - Changed creation of channels to not require a thing type, Christoph Weitkamp - Changed pattern for validating last segment to contain either a single `#` or none
    • Constructor Detail

      • ChannelUID

        public ChannelUID​(String channelUid)
        Parses a ChannelUID for a given string. The UID must be in the format 'bindingId:segment:segment:...'.
        Parameters:
        channelUid - uid in form a string (must not be null)
      • ChannelUID

        public ChannelUID​(ThingUID thingUID,
                          String id)
        Parameters:
        thingUID - the unique identifier of the thing the channel belongs to
        id - the channel's id
      • ChannelUID

        public ChannelUID​(ChannelGroupUID channelGroupUID,
                          String id)
        Parameters:
        channelGroupUID - the unique identifier of the channel group the channel belongs to
        id - the channel's id
      • ChannelUID

        public ChannelUID​(ThingUID thingUID,
                          String groupId,
                          String id)
        Parameters:
        thingUID - the unique identifier of the thing the channel belongs to
        groupId - the channel's group id
        id - the channel's id
      • ChannelUID

        @Deprecated
        public ChannelUID​(ThingTypeUID thingTypeUID,
                          String thingId,
                          String id)
        Deprecated.
        Parameters:
        thingTypeUID - the unique id of the thing's thingType
        thingId - the id of the thing the channel belongs to
        id - the channel's id
      • ChannelUID

        @Deprecated
        public ChannelUID​(String bindingId,
                          String thingTypeId,
                          String thingId,
                          String id)
        Deprecated.
        Parameters:
        bindingId - the binding id of the thingType
        thingTypeId - the thing type id of the thing's thingType
        thingId - the id of the thing the channel belongs to
        id - the channel's id
      • ChannelUID

        @Deprecated
        public ChannelUID​(String bindingId,
                          String thingTypeId,
                          String thingId,
                          String groupId,
                          String id)
        Deprecated.
        Parameters:
        bindingId - the binding id of the thingType
        thingTypeId - the thing type id of the thing's thingType
        thingId - the id of the thing the channel belongs to
        groupId - the channel's group id
        id - the channel's id
    • Method Detail

      • getId

        public String getId()
        Returns the id.
        Returns:
        id
      • getIdWithoutGroup

        public String getIdWithoutGroup()
        Returns the id without the group id.
        Returns:
        id id without group id
      • isInGroup

        public boolean isInGroup()
      • getGroupId

        public @Nullable String getGroupId()
        Returns the group id.
        Returns:
        group id or null if channel is not in a group
      • getMinimalNumberOfSegments

        protected int getMinimalNumberOfSegments()
        Description copied from class: AbstractUID
        Specifies how many segments the UID has to have at least.
        Specified by:
        getMinimalNumberOfSegments in class AbstractUID
        Returns:
      • getThingUID

        public ThingUID getThingUID()
        Returns the thing UID
        Returns:
        the thing UID