Java 17 features (N-S) (#15565)
- add missing @override - Java style array syntax - remove redundant modifiers - always move String constants to left side in comparisons - simplify lambda expressions and return statements - use replace instead of replaceAll w/o regex - instanceof matching and multiline strings Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
@@ -68,8 +68,8 @@ public class SMSModemActions implements ThingActions {
|
||||
|
||||
public static void sendSMS(@Nullable ThingActions actions, @Nullable String recipient, @Nullable String message,
|
||||
@Nullable String encoding) {
|
||||
if (actions instanceof SMSModemActions) {
|
||||
((SMSModemActions) actions).sendSMS(recipient, message, encoding);
|
||||
if (actions instanceof SMSModemActions smsModemActions) {
|
||||
smsModemActions.sendSMS(recipient, message, encoding);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Instance is not an SMSModemActions class.");
|
||||
}
|
||||
|
||||
@@ -65,8 +65,8 @@ public class SMSConversationHandler extends BaseThingHandler {
|
||||
thing.getUID(), getRecipient());
|
||||
}
|
||||
ThingHandler handler = bridge.getHandler();
|
||||
if (handler instanceof SMSModemBridgeHandler) {
|
||||
this.bridgeHandler = (SMSModemBridgeHandler) handler;
|
||||
if (handler instanceof SMSModemBridgeHandler smsModemBridgeHandler) {
|
||||
this.bridgeHandler = smsModemBridgeHandler;
|
||||
} else {
|
||||
throw new ConfigurationException("No available bridge handler found for SMSConversation {} bridge {} .",
|
||||
thing.getUID(), bridge.getUID());
|
||||
|
||||
Reference in New Issue
Block a user