Class DiscoveryResultBuilder
java.lang.Object
org.openhab.core.config.discovery.DiscoveryResultBuilder
The
DiscoveryResultBuilder helps creating a DiscoveryResult through the builder pattern.- Author:
- Kai Kreuzer - Initial contribution, Andre Fuechsel - added support for time to live, Thomas Höfer - Added representation
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a result with the settings of this builder.static DiscoveryResultBuilderCreates a new builder for a given thing UID.withBridge(@Nullable ThingUID bridgeUID) Sets the bridgeUID of the desired result.Sets the label of the desired result.withProperties(@Nullable Map<String, Object> properties) Adds properties to the desired result.withProperty(String key, Object value) Adds a property to the desired result.withRepresentationProperty(@Nullable String representationProperty) Sets the representation Property of the desired result.withThingType(@Nullable ThingTypeUID thingTypeUID) Explicitly sets the thing type.withTTL(long ttl) Sets the time to live for the result in seconds.
-
Method Details
-
create
Creates a new builder for a given thing UID.- Parameters:
thingUID- the thing UID for which the builder should be created-- Returns:
- a new instance of a
DiscoveryResultBuilder
-
withThingType
Explicitly sets the thing type.- Parameters:
thingTypeUID- theThingTypeUID- Returns:
- the updated builder
-
withProperties
Adds properties to the desired result.- Parameters:
properties- of the desired result- Returns:
- the updated builder
-
withProperty
Adds a property to the desired result.- Parameters:
key- property of the desired result- Returns:
- the updated builder
-
withRepresentationProperty
Sets the representation Property of the desired result.- Parameters:
representationProperty- the representation property of the desired result- Returns:
- the updated builder
-
withBridge
Sets the bridgeUID of the desired result.- Parameters:
bridgeUID- of the desired result- Returns:
- the updated builder
-
withLabel
Sets the label of the desired result.- Parameters:
label- of the desired result- Returns:
- the updated builder
-
withTTL
Sets the time to live for the result in seconds.- Parameters:
ttl- time to live in seconds- Returns:
- the updated builder
-
build
Builds a result with the settings of this builder.- Returns:
- the desired result
-