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

@@ -62,7 +62,7 @@ public class HeosActions implements ThingActions {
return handler.getApiConnection();
}
@RuleAction(label = "Play Input", description = "Play an input from another device")
@RuleAction(label = "play an input", description = "Play an input from another device.")
public void playInputFromPlayer(
@ActionInput(name = "source", label = "Source Player", description = "Player used for input") @Nullable Integer sourcePlayer,
@ActionInput(name = "input", label = "Source Input", description = "Input source used") @Nullable String input,
@@ -88,12 +88,8 @@ public class HeosActions implements ThingActions {
}
}
public static void playInputFromPlayer(@Nullable ThingActions actions, @Nullable Integer sourcePlayer,
@Nullable String input, @Nullable Integer destinationPlayer) {
if (actions instanceof HeosActions) {
((HeosActions) actions).playInputFromPlayer(sourcePlayer, input, destinationPlayer);
} else {
throw new IllegalArgumentException("Actions is not an instance of HeosActions");
}
public static void playInputFromPlayer(ThingActions actions, @Nullable Integer sourcePlayer, @Nullable String input,
@Nullable Integer destinationPlayer) {
((HeosActions) actions).playInputFromPlayer(sourcePlayer, input, destinationPlayer);
}
}