Interface Item

    • Method Detail

      • getState

        State getState()
        returns the current state of the item
        Returns:
        the current state
      • getStateAs

        <T extends State> @Nullable T getStateAs​(Class<T> typeClass)
        returns the current state of the item as a specific type
        Returns:
        the current state in the requested type or null, if state cannot be provided as the requested type
      • getName

        String getName()
        returns the name of the item
        Returns:
        the name of the item
      • getType

        String getType()
        returns the item type as defined by ItemFactorys
        Returns:
        the item type
      • getAcceptedDataTypes

        List<Class<? extends State>> getAcceptedDataTypes()

        This method provides a list of all data types that can be used to update the item state

        Imagine e.g. a dimmer device: It's status could be 0%, 10%, 50%, 100%, but also OFF or ON and maybe UNDEFINED. So the accepted data types would be in this case PercentType, OnOffType and UnDefType

        The order of data types denotes the order of preference. So in case a state needs to be converted in order to be accepted, it will be attempted to convert it to a type from top to bottom. Therefore the type with the least information loss should be on top of the list - in the example above the PercentType carries more information than the OnOffType, hence it is listed first.

        Returns:
        a list of data types that can be used to update the item state
      • getAcceptedCommandTypes

        List<Class<? extends Command>> getAcceptedCommandTypes()

        This method provides a list of all command types that can be used for this item

        Imagine e.g. a dimmer device: You could ask it to dim to 0%, 10%, 50%, 100%, but also to turn OFF or ON. So the accepted command types would be in this case PercentType, OnOffType

        Returns:
        a list of all command types that can be used for this item
      • getGroupNames

        List<String> getGroupNames()
        Returns a list of the names of the groups this item belongs to.
        Returns:
        list of item group names
      • getTags

        Set<String> getTags()
        Returns a set of tags. If the item is not tagged, an empty set is returned.
        Returns:
        set of tags.
      • getLabel

        @Nullable String getLabel()
        Returns the label of the item or null if no label is set.
        Returns:
        item label or null
      • hasTag

        boolean hasTag​(String tag)
        Returns true if the item's tags contains the specific tag, otherwise false.
        Parameters:
        tag - a tag whose presence in the item's tags is to be tested.
        Returns:
        true if the item's tags contains the specific tag, otherwise false.
      • getCategory

        @Nullable String getCategory()
        Returns the category of the item or null if no category is set.
        Returns:
        category or null
      • getStateDescription

        @Nullable StateDescription getStateDescription()
        Returns the first provided state description (uses the default locale). If options are defined on the channel, they are included in the returned state description.
        Returns:
        state description (can be null)
      • getStateDescription

        @Nullable StateDescription getStateDescription​(@Nullable Locale locale)
        Returns the first provided state description for a given locale. If options are defined on the channel, they are included in the returned state description.
        Parameters:
        locale - locale (can be null)
        Returns:
        state description (can be null)