Java 17 features (A-G) (#15516)
- 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:
@@ -21,8 +21,8 @@ import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.time.format.FormatStyle;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -262,7 +262,7 @@ public class GardenaAccountHandler extends BaseBridgeHandler implements GardenaS
|
||||
|
||||
@Override
|
||||
public Collection<Class<? extends ThingHandlerService>> getServices() {
|
||||
return Collections.singleton(GardenaDeviceDiscoveryService.class);
|
||||
return Set.of(GardenaDeviceDiscoveryService.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -231,7 +231,7 @@ public class GardenaThingHandler extends BaseThingHandler {
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
logger.debug("Command received: {}", command);
|
||||
try {
|
||||
boolean isOnCommand = command instanceof OnOffType && ((OnOffType) command) == OnOffType.ON;
|
||||
boolean isOnCommand = command instanceof OnOffType onOffCommand && onOffCommand == OnOffType.ON;
|
||||
String dataItemProperty = getDeviceDataItemProperty(channelUID);
|
||||
if (RefreshType.REFRESH == command) {
|
||||
logger.debug("Refreshing Gardena connection");
|
||||
|
||||
@@ -20,7 +20,7 @@ package org.openhab.binding.gardena.internal.model.dto.command;
|
||||
public class ValveCommand extends GardenaCommand {
|
||||
private static final String COMMAND_TYPE = "VALVE_CONTROL";
|
||||
|
||||
public static enum ValveControl {
|
||||
public enum ValveControl {
|
||||
START_SECONDS_TO_OVERRIDE,
|
||||
STOP_UNTIL_NEXT_TASK,
|
||||
PAUSE,
|
||||
|
||||
Reference in New Issue
Block a user