[infrastructure] add external null-annotations (#8848)
Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
@@ -408,7 +408,7 @@ public class TelegramHandler extends BaseThingHandler {
|
||||
return replyIdToCallbackId.get(new ReplyKey(chatId, replyId));
|
||||
}
|
||||
|
||||
public Integer removeMessageId(Long chatId, String replyId) {
|
||||
public @Nullable Integer removeMessageId(Long chatId, String replyId) {
|
||||
return replyIdToMessageId.remove(new ReplyKey(chatId, replyId));
|
||||
}
|
||||
|
||||
|
||||
@@ -255,6 +255,9 @@ public class TelegramActions implements ThingActions {
|
||||
public boolean sendTelegram(@ActionInput(name = "chatId") @Nullable Long chatId,
|
||||
@ActionInput(name = "message") @Nullable String message,
|
||||
@ActionInput(name = "args") @Nullable Object... args) {
|
||||
if (message == null) {
|
||||
return false;
|
||||
}
|
||||
return sendTelegram(chatId, String.format(message, args));
|
||||
}
|
||||
|
||||
@@ -444,7 +447,14 @@ public class TelegramActions implements ThingActions {
|
||||
|
||||
public static boolean sendTelegramAnswer(ThingActions actions, @Nullable String chatId, @Nullable String replyId,
|
||||
@Nullable String message) {
|
||||
return ((TelegramActions) actions).sendTelegramAnswer(Long.valueOf(chatId), replyId, message);
|
||||
if (actions instanceof TelegramActions) {
|
||||
if (chatId == null) {
|
||||
return false;
|
||||
}
|
||||
return ((TelegramActions) actions).sendTelegramAnswer(Long.valueOf(chatId), replyId, message);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Actions is not an instance of TelegramActions");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user