From 68c8db822712fbaa17fdb002f0a02e5fbb18d8d1 Mon Sep 17 00:00:00 2001 From: Markus Rathgeb Date: Fri, 1 Feb 2019 13:24:25 +0000 Subject: [PATCH] add missing no-arg constructors (#509) * FirmwareUpdateProgressInfo * FirmwareStatusInfo * FirmwareUpdateResultInfo Fixes: https://github.com/openhab/openhab-core/issues/507 Signed-off-by: Markus Rathgeb --- .../core/thing/firmware/FirmwareStatusInfo.java | 11 +++++++++++ .../firmware/FirmwareUpdateProgressInfo.java | 15 +++++++++++++++ .../thing/firmware/FirmwareUpdateResultInfo.java | 11 +++++++++++ 3 files changed, 37 insertions(+) diff --git a/bundles/org.openhab.core.thing/src/main/java/org/eclipse/smarthome/core/thing/firmware/FirmwareStatusInfo.java b/bundles/org.openhab.core.thing/src/main/java/org/eclipse/smarthome/core/thing/firmware/FirmwareStatusInfo.java index a26d13d64..099e4329e 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/eclipse/smarthome/core/thing/firmware/FirmwareStatusInfo.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/eclipse/smarthome/core/thing/firmware/FirmwareStatusInfo.java @@ -37,6 +37,17 @@ public final class FirmwareStatusInfo { @Nullable private final String firmwareVersion; + /** + * Package protected default constructor to allow reflective instantiation. + * + * !!! DO NOT REMOVE - Gson needs it !!! + */ + FirmwareStatusInfo() { + thingUID = new ThingUID("internal:reflective:constructor"); + firmwareStatus = FirmwareStatus.UNKNOWN; + firmwareVersion = null; + } + private FirmwareStatusInfo(ThingUID thingUID, FirmwareStatus firmwareStatus, @Nullable String firmwareVersion) { Objects.requireNonNull(thingUID, "Thing UID must not be null."); this.thingUID = thingUID; diff --git a/bundles/org.openhab.core.thing/src/main/java/org/eclipse/smarthome/core/thing/firmware/FirmwareUpdateProgressInfo.java b/bundles/org.openhab.core.thing/src/main/java/org/eclipse/smarthome/core/thing/firmware/FirmwareUpdateProgressInfo.java index edd91d14f..96158b7f7 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/eclipse/smarthome/core/thing/firmware/FirmwareUpdateProgressInfo.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/eclipse/smarthome/core/thing/firmware/FirmwareUpdateProgressInfo.java @@ -13,6 +13,7 @@ package org.eclipse.smarthome.core.thing.firmware; import java.util.Collection; +import java.util.Collections; import java.util.Objects; import org.eclipse.jdt.annotation.NonNull; @@ -44,6 +45,20 @@ public final class FirmwareUpdateProgressInfo { private final @Nullable Integer progress; + /** + * Package protected default constructor to allow reflective instantiation. + * + * !!! DO NOT REMOVE - Gson needs it !!! + */ + FirmwareUpdateProgressInfo() { + thingUID = new ThingUID("internal:reflective:constructor"); + firmwareVersion = ""; + progressStep = ProgressStep.WAITING; + sequence = Collections.emptyList(); + pending = false; + progress = null; + } + private FirmwareUpdateProgressInfo(ThingUID thingUID, String firmwareVersion, ProgressStep progressStep, Collection sequence, boolean pending, int progress) { Objects.requireNonNull(thingUID, "ThingUID must not be null."); diff --git a/bundles/org.openhab.core.thing/src/main/java/org/eclipse/smarthome/core/thing/firmware/FirmwareUpdateResultInfo.java b/bundles/org.openhab.core.thing/src/main/java/org/eclipse/smarthome/core/thing/firmware/FirmwareUpdateResultInfo.java index b927dbfb6..26b75d956 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/eclipse/smarthome/core/thing/firmware/FirmwareUpdateResultInfo.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/eclipse/smarthome/core/thing/firmware/FirmwareUpdateResultInfo.java @@ -33,6 +33,17 @@ public final class FirmwareUpdateResultInfo { private final ThingUID thingUID; + /** + * Package protected default constructor to allow reflective instantiation. + * + * !!! DO NOT REMOVE - Gson needs it !!! + */ + FirmwareUpdateResultInfo() { + thingUID = new ThingUID("internal:reflective:constructor"); + result = FirmwareUpdateResult.ERROR; + errorMessage = null; + } + private FirmwareUpdateResultInfo(ThingUID thingUID, FirmwareUpdateResult result, @Nullable String errorMessage) { Objects.requireNonNull(thingUID, "The thingUID must not be null."); this.thingUID = thingUID;