Class BaseDynamicStateDescriptionProvider

    • Constructor Detail

      • BaseDynamicStateDescriptionProvider

        public BaseDynamicStateDescriptionProvider()
    • Method Detail

      • setStatePattern

        public void setStatePattern​(ChannelUID channelUID,
                                    String pattern)
        For a given channel UID, set a pattern that should be used for the channel, instead of the one defined statically in the ChannelType.
        Parameters:
        channelUID - the channel UID of the channel
        pattern - a pattern
      • setStateOptions

        public void setStateOptions​(ChannelUID channelUID,
                                    List<StateOption> options)
        For a given channel UID, set a List of StateOptions that should be used for the channel, instead of the one defined statically in the ChannelType.
        Parameters:
        channelUID - the channel UID of the channel
        options - a List of StateOptions
      • getStateDescription

        public @Nullable StateDescription getStateDescription​(Channel channel,
                                                              @Nullable StateDescription original,
                                                              @Nullable Locale locale)
        Description copied from interface: DynamicStateDescriptionProvider
        For a given channel UID, return a StateDescription that should be used for the channel, instead of the one defined statically in the ChannelType. For a particular channel, there should be only one provider of the dynamic state description. When more than one description is provided for the same channel (by different providers), only one will be used, from the provider that registered first.
        Specified by:
        getStateDescription in interface DynamicStateDescriptionProvider
        Parameters:
        channel - channel
        original - original state description retrieved from the channel type this is the description to be replaced by the provided one
        locale - locale (can be null)
        Returns:
        state description or null if none provided
      • localizeStatePattern

        protected @Nullable String localizeStatePattern​(String pattern,
                                                        Channel channel,
                                                        @Nullable Locale locale)
        Localizes a pattern that should be used for the channel.
        Parameters:
        pattern - a pattern
        channel - the channel
        locale - a locale
        Returns:
        the localized pattern
      • activate

        protected void activate​(org.osgi.service.component.ComponentContext componentContext)
      • deactivate

        public void deactivate()