Java 17 features (H-M) (#15520)

- 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
- remove null check before instanceof

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
Holger Friedrich
2023-09-08 14:36:59 +02:00
committed by GitHub
parent 3751fd0646
commit edaf17b345
519 changed files with 2703 additions and 2660 deletions

View File

@@ -200,13 +200,12 @@ public class IAqualinkHandler extends BaseThingHandler {
: "on".equals(command.toString()) ? "1" : command.toString();
client.lightCommand(serialNumber, sessionId, auxId, cmd,
AuxiliaryType.fromChannelTypeUID(getChannelTypeUID(channelUID)).getSubType());
} else if (command instanceof OnOffType) {
} else if (command instanceof OnOffType onOffCommand) {
// these are toggle commands and require we have the current state to turn on/off
Auxiliary[] auxs = client.getAux(serialNumber, sessionId);
Optional<Auxiliary> optional = Arrays.stream(auxs).filter(o -> o.getName().equals(channelName))
.findFirst();
if (optional.isPresent()) {
OnOffType onOffCommand = (OnOffType) command;
State currentState = toState(channelName, "Switch", optional.get().getState());
if (!currentState.equals(onOffCommand)) {
client.auxSetCommand(serialNumber, sessionId, channelName);
@@ -226,8 +225,7 @@ public class IAqualinkHandler extends BaseThingHandler {
client.setPoolTemp(serialNumber, sessionId, value.floatValue());
}
}
} else if (command instanceof OnOffType) {
OnOffType onOffCommand = (OnOffType) command;
} else if (command instanceof OnOffType onOffCommand) {
// these are toggle commands and require we have the current state to turn on/off
if (channelName.startsWith("onetouch_")) {
OneTouch[] ota = client.getOneTouch(serialNumber, sessionId);