Rework ThingActions (#8755)
* Remove duplication by making use of default Java generated exceptions * Make ThingActions labels/descriptions more consistent Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
@@ -85,16 +85,12 @@ public class MQTTActions implements ThingActions {
|
||||
});
|
||||
}
|
||||
|
||||
public static void publishMQTT(@Nullable ThingActions actions, @Nullable String topic, @Nullable String value) {
|
||||
public static void publishMQTT(ThingActions actions, @Nullable String topic, @Nullable String value) {
|
||||
publishMQTT(actions, topic, value, null);
|
||||
}
|
||||
|
||||
public static void publishMQTT(@Nullable ThingActions actions, @Nullable String topic, @Nullable String value,
|
||||
public static void publishMQTT(ThingActions actions, @Nullable String topic, @Nullable String value,
|
||||
@Nullable Boolean retain) {
|
||||
if (actions instanceof MQTTActions) {
|
||||
((MQTTActions) actions).publishMQTT(topic, value, retain);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Actions is not an instance of MQTTActions");
|
||||
}
|
||||
((MQTTActions) actions).publishMQTT(topic, value, retain);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user