Class FirmwareBuilder
java.lang.Object
org.openhab.core.thing.binding.firmware.FirmwareBuilder
The builder to create a
Firmware.- Author:
- Thomas Höfer - Initial contribution, Dimitar Ivanov - Extracted as separate class for Firmware, introduced firmware restriction function
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the firmware.static FirmwareBuildercreate(ThingTypeUID thingTypeUID, String firmwareVersion) withChangelog(@Nullable String changelog) Adds the changelog to the builder.withDescription(@Nullable String description) Adds the description to the builder.withFirmwareRestriction(FirmwareRestriction firmwareRestriction) An additional restriction can be applied on the firmware by providing aFirmwareRestrictionfunction.withInputStream(@Nullable InputStream inputStream) Adds the input stream for the binary content to the builder.withMd5Hash(@Nullable String md5Hash) Adds the given md5 hash value to the builder.Adds the model to the builder.withModelRestricted(boolean modelRestricted) Sets the modelRestricted flag in the builder.withOnlineChangelog(@Nullable URL onlineChangelog) Adds the online changelog to the builder.withPrerequisiteVersion(@Nullable String prerequisiteVersion) Adds the prerequisite version to the builder.withProperties(Map<String, String> properties) Adds the properties to the builder.withVendor(@Nullable String vendor) Adds the vendor to the builder.
-
Method Details
-
create
-
withVendor
Adds the vendor to the builder.- Parameters:
vendor- the vendor to be added to the builder (can be null)- Returns:
- the updated builder
-
withModel
Adds the model to the builder.- Parameters:
model- the model to be added to the builder (can be null)- Returns:
- the updated builder
-
withModelRestricted
Sets the modelRestricted flag in the builder.- Parameters:
modelRestricted- the modelRestricted flag to be added to the builder- Returns:
- the updated builder
-
withDescription
Adds the description to the builder.- Parameters:
description- the description to be added to the builder (can be null)- Returns:
- the updated builder
-
withPrerequisiteVersion
Adds the prerequisite version to the builder.- Parameters:
prerequisiteVersion- the prerequisite version to be added to the builder (can be null)- Returns:
- the updated builder
-
withChangelog
Adds the changelog to the builder.- Parameters:
changelog- the changelog to be added to the builder (can be null)- Returns:
- the updated builder
-
withOnlineChangelog
Adds the online changelog to the builder.- Parameters:
onlineChangelog- the online changelog to be added to the builder (can be null)- Returns:
- the updated builder
-
withInputStream
Adds the input stream for the binary content to the builder.- Parameters:
inputStream- the input stream for the binary content to be added to the builder (can be null)- Returns:
- the updated builder
-
withProperties
Adds the properties to the builder.- Parameters:
properties- the properties to be added to the builder (not null)- Returns:
- the updated builder
- Throws:
IllegalArgumentException- if the given properties are null
-
withMd5Hash
Adds the given md5 hash value to the builder.- Parameters:
md5Hash- the md5 hash value to be added to the builder (can be null)- Returns:
- the updated builder
-
withFirmwareRestriction
An additional restriction can be applied on the firmware by providing aFirmwareRestrictionfunction.- Parameters:
firmwareRestriction- aFirmwareRestrictionfor applying an additional restriction function on the firmware (not null)- Returns:
- the updated builder
- Throws:
IllegalArgumentException- if the given function is null
-
build
Builds the firmware.- Returns:
- the firmware instance based on this builder
- Throws:
IllegalArgumentException- when the model restricted property (withModelRestricted(boolean)) is set to true, but the model (withModel(String)) is not set
-