Package org.openhab.core.types
Class StateDescriptionFragmentBuilder
java.lang.Object
org.openhab.core.types.StateDescriptionFragmentBuilder
Builds a
StateDescriptionFragment
with the relevant parts only.- Author:
- Henning Treu - Initial contribution
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds aStateDescriptionFragment
from the values of this builder.create()
Creates and returns a fresh builder instance.create
(StateDescription legacy) Creates a builder instance and initializes all fields from the givenStateDescription
.create
(StateDescriptionFragment fragment) Creates a builder instance and initializes all fields from the givenStateDescriptionFragment
.withMaximum
(BigDecimal maximum) Set the maximum for the resultingStateDescriptionFragment
.withMinimum
(BigDecimal minimum) Set the minimum for the resultingStateDescriptionFragment
.withOption
(StateOption option) Ass aStateOption
for the resultingStateDescriptionFragment
.withOptions
(List<StateOption> options) Set theStateOption
s for the resultingStateDescriptionFragment
.withPattern
(String pattern) Set the pattern for the resultingStateDescriptionFragment
.withReadOnly
(Boolean readOnly) Set readOnly for the resultingStateDescriptionFragment
.withStep
(BigDecimal step) Set the step for the resultingStateDescriptionFragment
.
-
Method Details
-
create
Creates and returns a fresh builder instance.- Returns:
- a fresh
StateDescriptionFragmentBuilder
instance.
-
create
Creates a builder instance and initializes all fields from the givenStateDescriptionFragment
. Note: State options will only be taken into account if the list is not empty.- Parameters:
fragment
- theStateDescriptionFragment
this builder be initialized from.- Returns:
- the builder.
-
create
Creates a builder instance and initializes all fields from the givenStateDescription
. Note: State options will only be taken into account if the list is not empty.- Parameters:
legacy
- theStateDescription
this builder be initialized from.- Returns:
- the builder.
-
build
Builds aStateDescriptionFragment
from the values of this builder.- Returns:
- a
StateDescriptionFragment
from the values of this builder.
-
withMaximum
Set the maximum for the resultingStateDescriptionFragment
.- Parameters:
maximum
- the maximum for the resultingStateDescriptionFragment
.- Returns:
- this builder.
-
withMinimum
Set the minimum for the resultingStateDescriptionFragment
.- Parameters:
minimum
- the minimum for the resultingStateDescriptionFragment
.- Returns:
- this builder.
-
withStep
Set the step for the resultingStateDescriptionFragment
.- Parameters:
step
- the step for the resultingStateDescriptionFragment
.- Returns:
- this builder.
-
withPattern
Set the pattern for the resultingStateDescriptionFragment
.- Parameters:
pattern
- the pattern for the resultingStateDescriptionFragment
.- Returns:
- this builder.
-
withReadOnly
Set readOnly for the resultingStateDescriptionFragment
.- Parameters:
readOnly
- readOnly for the resultingStateDescriptionFragment
.- Returns:
- this builder.
-
withOption
Ass aStateOption
for the resultingStateDescriptionFragment
.- Parameters:
option
- aStateOption
for the resultingStateDescriptionFragment
.- Returns:
- this builder.
-
withOptions
Set theStateOption
s for the resultingStateDescriptionFragment
.- Parameters:
options
- theStateOption
s for the resultingStateDescriptionFragment
.- Returns:
- this builder.
-