Package org.openhab.core.types
Class StateDescription
java.lang.Object
org.openhab.core.types.StateDescription
The
StateDescription
describes restrictions of an item state and gives information how to interpret it.- Author:
- Dennis Nobel - Initial contribution
-
Field Summary
Modifier and TypeFieldDescriptionprotected final @Nullable BigDecimal
protected final @Nullable BigDecimal
protected final List<StateOption>
protected final @Nullable String
protected final boolean
protected final @Nullable BigDecimal
-
Constructor Summary
ModifierConstructorDescriptionprotected
StateDescription
(@Nullable BigDecimal minimum, @Nullable BigDecimal maximum, @Nullable BigDecimal step, @Nullable String pattern, boolean readOnly, @Nullable List<StateOption> options) Creates a state description object. -
Method Summary
Modifier and TypeMethodDescriptionboolean
@Nullable BigDecimal
Returns the maximum value of an item state.@Nullable BigDecimal
Returns the minimum value of an item state.Returns a list of predefined states with their label.@Nullable String
Returns the pattern to render the state to a string.@Nullable BigDecimal
getStep()
Returns the step size.int
hashCode()
boolean
Returnstrue
if the state can only be read but not written orfalse
if the state can also be written.toString()
-
Field Details
-
minimum
-
maximum
-
step
-
pattern
-
readOnly
protected final boolean readOnly -
options
-
-
Constructor Details
-
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 statemaximum
- maximum value of the statestep
- step sizepattern
- pattern to render the statereadOnly
- if the state can be changed by the systemoptions
- predefined list of options
-
-
Method Details
-
getMinimum
Returns the minimum value of an item state.- Returns:
- minimum value of an item state
-
getMaximum
Returns the maximum value of an item state.- Returns:
- maximum value of an item state
-
getStep
Returns the step size.- Returns:
- step size
-
getPattern
Returns the pattern to render the state to a string.- Returns:
- pattern
-
isReadOnly
public boolean isReadOnly()Returnstrue
if the state can only be read but not written orfalse
if the state can also be written. Typically a sensor can only be read.- Returns:
true
for readOnly,false
otherwise.
-
getOptions
Returns a list of predefined states with their label.- Returns:
- a list of predefined states with their label
-
hashCode
public int hashCode() -
equals
-
toString
-