Class StateDescription


  • @NonNullByDefault
    public class StateDescription
    extends Object
    The StateDescription describes restrictions of an item state and gives information how to interpret it.
    Author:
    Dennis Nobel - Initial contribution
    • Field Detail

      • minimum

        protected final @Nullable BigDecimal minimum
      • maximum

        protected final @Nullable BigDecimal maximum
      • pattern

        protected final @Nullable String pattern
      • readOnly

        protected final boolean readOnly
    • Constructor Detail

      • StateDescription

        protected StateDescription​(@Nullable BigDecimal minimum,
                                   @Nullable BigDecimal maximum,
                                   @Nullable BigDecimal step,
                                   @Nullable String pattern,
                                   boolean readOnly,
                                   @Nullable List<StateOption> options)
        Creates a state description object.
        Parameters:
        minimum - minimum value of the state
        maximum - maximum value of the state
        step - step size
        pattern - pattern to render the state
        readOnly - if the state can be changed by the system
        options - predefined list of options
    • Method Detail

      • getMinimum

        public @Nullable BigDecimal getMinimum()
        Returns the minimum value of an item state.
        Returns:
        minimum value of an item state
      • getMaximum

        public @Nullable BigDecimal getMaximum()
        Returns the maximum value of an item state.
        Returns:
        maximum value of an item state
      • getStep

        public @Nullable BigDecimal getStep()
        Returns the step size.
        Returns:
        step size
      • getPattern

        public @Nullable String getPattern()
        Returns the pattern to render the state to a string.
        Returns:
        pattern
      • isReadOnly

        public boolean isReadOnly()
        Returns true if the state can only be read but not written or false if the state can also be written. Typically a sensor can only be read.
        Returns:
        true for readOnly, false otherwise.
      • getOptions

        public List<StateOption> getOptions()
        Returns a list of predefined states with their label.
        Returns:
        a list of predefined states with their label
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public boolean equals​(@Nullable Object obj)
        Overrides:
        equals in class Object