Java 17 features (T-Z) (#15576)
- 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:
@@ -110,7 +110,6 @@ public class Communicator {
|
||||
}
|
||||
}
|
||||
br.close();
|
||||
socket.close();
|
||||
} catch (IOException e) {
|
||||
callback.communicationProblem();
|
||||
}
|
||||
@@ -150,7 +149,6 @@ public class Communicator {
|
||||
logger.debug("sendingArray: {}", Arrays.toString(dataToSend));
|
||||
|
||||
output.write(dataToSend);
|
||||
socket.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,20 +92,20 @@ public class VentaThingHandler extends BaseThingHandler {
|
||||
}
|
||||
break;
|
||||
case VentaAirBindingConstants.CHANNEL_FAN_SPEED:
|
||||
if (command instanceof DecimalType) {
|
||||
int fanStage = ((DecimalType) command).intValue();
|
||||
if (command instanceof DecimalType decimalCommand) {
|
||||
int fanStage = decimalCommand.intValue();
|
||||
dispatchActionToDevice(new FanAction(fanStage));
|
||||
}
|
||||
break;
|
||||
case VentaAirBindingConstants.CHANNEL_TARGET_HUMIDITY:
|
||||
if (command instanceof DecimalType) {
|
||||
int targetHumidity = ((DecimalType) command).intValue();
|
||||
if (command instanceof DecimalType decimalCommand) {
|
||||
int targetHumidity = decimalCommand.intValue();
|
||||
dispatchActionToDevice(new HumidityAction(targetHumidity));
|
||||
}
|
||||
break;
|
||||
case VentaAirBindingConstants.CHANNEL_TIMER:
|
||||
if (command instanceof DecimalType) {
|
||||
int timer = ((DecimalType) command).intValue();
|
||||
if (command instanceof DecimalType decimalCommand) {
|
||||
int timer = decimalCommand.intValue();
|
||||
dispatchActionToDevice(new TimerAction(timer));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -18,7 +18,6 @@ import java.net.DatagramSocket;
|
||||
import java.net.SocketException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Duration;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
@@ -53,8 +52,8 @@ import com.google.gson.JsonSyntaxException;
|
||||
@Component(service = DiscoveryService.class, configurationPid = "discovery.ventaair")
|
||||
public class VentaDeviceDiscovery extends AbstractDiscoveryService {
|
||||
private static final String REPRESENTATION_PROPERTY = "macAddress";
|
||||
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections
|
||||
.singleton(VentaAirBindingConstants.THING_TYPE_LW60T);
|
||||
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set
|
||||
.of(VentaAirBindingConstants.THING_TYPE_LW60T);
|
||||
// defined as int, because AbstractDiscoveryService wants and int and not long as provided by Duration.getSeconds()
|
||||
private static final int MANUAL_DISCOVERY_TIME = 30;
|
||||
private static final Duration TIME_BETWEEN_SCANS = Duration.ofSeconds(30);
|
||||
|
||||
Reference in New Issue
Block a user