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:
@@ -71,8 +71,8 @@ public class FineOffsetWeatherStationHandlerFactory extends BaseThingHandlerFact
|
||||
protected @Nullable ThingHandler createHandler(Thing thing) {
|
||||
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
|
||||
|
||||
if (THING_TYPE_GATEWAY.equals(thingTypeUID) && thing instanceof Bridge) {
|
||||
return new FineOffsetGatewayHandler((Bridge) thing, gatewayDiscoveryService, channelTypeRegistry,
|
||||
if (THING_TYPE_GATEWAY.equals(thingTypeUID) && thing instanceof Bridge bridge) {
|
||||
return new FineOffsetGatewayHandler(bridge, gatewayDiscoveryService, channelTypeRegistry,
|
||||
translationProvider, localeProvider, timeZoneProvider);
|
||||
}
|
||||
if (THING_TYPE_SENSOR.equals(thingTypeUID)) {
|
||||
|
||||
@@ -24,9 +24,9 @@ import java.net.SocketException;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -83,7 +83,7 @@ public class FineOffsetGatewayDiscoveryService extends AbstractDiscoveryService
|
||||
@Activate
|
||||
public FineOffsetGatewayDiscoveryService(@Reference TranslationProvider translationProvider,
|
||||
@Reference LocaleProvider localeProvider) throws IllegalArgumentException {
|
||||
super(Collections.singleton(THING_TYPE_GATEWAY), DISCOVERY_TIME, true);
|
||||
super(Set.of(THING_TYPE_GATEWAY), DISCOVERY_TIME, true);
|
||||
this.translationProvider = translationProvider;
|
||||
this.localeProvider = localeProvider;
|
||||
this.bundle = FrameworkUtil.getBundle(FineOffsetGatewayDiscoveryService.class);
|
||||
|
||||
@@ -336,6 +336,7 @@ public enum Measurand {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractMeasuredValues(byte[] data, int offset, @Nullable Integer channel, ConversionContext context,
|
||||
@Nullable ParserCustomizationType customizationType, List<MeasuredValue> result) {
|
||||
MeasureType measureType = getMeasureType(customizationType);
|
||||
|
||||
Reference in New Issue
Block a user