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
  • Field Details

    • CHANNEL_SEGMENT_PATTERN

      public static final Pattern CHANNEL_SEGMENT_PATTERN
    • CHANNEL_GROUP_SEPARATOR

      public static final String CHANNEL_GROUP_SEPARATOR
      See Also:
  • Constructor Details

    • 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
    • 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
  • Method Details

    • 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:
      the number of segments
    • validateSegment

      protected void validateSegment(String segment, int index, int length)
      Overrides:
      validateSegment in class AbstractUID
    • getThingUID

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