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:
Wouter Born
2020-10-15 10:53:53 +02:00
committed by GitHub
parent aef1d10f40
commit 978e122e00
40 changed files with 305 additions and 785 deletions

View File

@@ -63,13 +63,9 @@ public class PushbulletActions implements ThingActions {
return localHandler.sendPush(recipient, title, message, "note");
}
public static boolean sendPushbulletNote(@Nullable ThingActions actions, @Nullable String recipient,
@Nullable String title, @Nullable String message) {
if (actions instanceof PushbulletActions) {
return ((PushbulletActions) actions).sendPushbulletNote(recipient, title, message);
} else {
throw new IllegalArgumentException("Actions is not an instance of PushbulletActions");
}
public static boolean sendPushbulletNote(ThingActions actions, @Nullable String recipient, @Nullable String title,
@Nullable String message) {
return ((PushbulletActions) actions).sendPushbulletNote(recipient, title, message);
}
@RuleAction(label = "@text/actionSendPushbulletNoteLabel", description = "@text/actionSendPushbulletNoteDesc")
@@ -87,12 +83,8 @@ public class PushbulletActions implements ThingActions {
return localHandler.sendPush(recipient, message, "note");
}
public static boolean sendPushbulletNote(@Nullable ThingActions actions, @Nullable String recipient,
public static boolean sendPushbulletNote(ThingActions actions, @Nullable String recipient,
@Nullable String message) {
if (actions instanceof PushbulletActions) {
return ((PushbulletActions) actions).sendPushbulletNote(recipient, message);
} else {
throw new IllegalArgumentException("Actions is not an instance of PushbulletActions");
}
return ((PushbulletActions) actions).sendPushbulletNote(recipient, message);
}
}

View File

@@ -3,7 +3,7 @@ binding.pushbullet.name = Pushbullet Binding
binding.pushbullet.description = The Pushbullet binding allows you to send messages to other users of the Pushbullet service.
# action
actionSendPushbulletNoteLabel = publish an Pushbullet message
actionSendPushbulletNoteLabel = publish a Pushbullet message
actionSendPushbulletNoteDesc = Publishes a Title to the given Pushbullet Recipient.
actionSendPushbulletNoteInputRecipientLabel = Pushbullet Recipient