Class ChannelDefinition


  • @NonNullByDefault
    public class ChannelDefinition
    extends Object
    The ChannelDefinition class defines a Channel of a ThingType.

    A Channel is part of a Thing that represents a functionality of it.

    Hint: This class is immutable.

    Author:
    Michael Grammling - Initial contribution, Chris Jackson - Added properties and label/description, Dennis Nobel - Introduced ChannelTypeRegistry and channel type references
    • Constructor Detail

      • ChannelDefinition

        @Deprecated
        public ChannelDefinition​(String id,
                                 ChannelTypeUID channelTypeUID)
                          throws IllegalArgumentException
        Deprecated.
        use the builder
        Creates a new instance of this class with the specified parameters.
        Parameters:
        id - the identifier of the channel (must neither be null nor empty)
        channelTypeUID - the type UID of the channel (must not be null)
        Throws:
        IllegalArgumentException - if the ID is null or empty, or the type is null
      • ChannelDefinition

        @Deprecated
        public ChannelDefinition​(String id,
                                 ChannelTypeUID channelTypeUID,
                                 @Nullable Map<String,​String> properties,
                                 @Nullable String label,
                                 @Nullable String description)
                          throws IllegalArgumentException
        Deprecated.
        use the builder
        Creates a new instance of this class with the specified parameters.
        Parameters:
        id - the identifier of the channel (must neither be null nor empty)
        channelTypeUID - the type UID of the channel (must not be null)
        properties - the properties this Channel provides (could be null)
        label - the label for the channel to override channelType (could be null)
        description - the description for the channel to override channelType (could be null)
        Throws:
        IllegalArgumentException - if the ID is null or empty, or the type is null
      • ChannelDefinition

        @Deprecated
        public ChannelDefinition​(String id,
                                 ChannelTypeUID channelTypeUID,
                                 @Nullable Map<String,​String> properties,
                                 @Nullable String label,
                                 @Nullable String description,
                                 @Nullable AutoUpdatePolicy autoUpdatePolicy)
                          throws IllegalArgumentException
        Deprecated.
        use the builder
        Creates a new instance of this class with the specified parameters.
        Parameters:
        id - the identifier of the channel (must neither be null nor empty)
        channelTypeUID - the type UID of the channel (must not be null)
        properties - the properties this Channel provides (could be null)
        label - the label for the channel to override channelType (could be null)
        description - the description for the channel to override channelType (could be null)
        autoUpdatePolicy - the auto update policy for the channel to override from the thing type (could be null)
        Throws:
        IllegalArgumentException - if the ID is null or empty, or the type is null
    • Method Detail

      • getId

        public String getId()
        Returns the identifier of the channel.
        Returns:
        the identifier of the channel (neither null, nor empty)
      • getChannelTypeUID

        public ChannelTypeUID getChannelTypeUID()
        Returns the type of the channel.
        Returns:
        the type of the channel (not null)
      • getLabel

        public @Nullable String getLabel()
        Returns the label (if set). If no label is set, getLabel will return null and the default label for the ChannelType is used.
        Returns:
        the label for the channel. Can be null.
      • getDescription

        public @Nullable String getDescription()
        Returns the description (if set). If no description is set, getDescription will return null and the default description for the ChannelType is used.
        Returns:
        the description for the channel. Can be null.
      • getAutoUpdatePolicy

        public @Nullable AutoUpdatePolicy getAutoUpdatePolicy()
        Returns the AutoUpdatePolicy to use for this channel.
        Returns:
        the auto update policy