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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user