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:
@@ -14,7 +14,6 @@ package org.openhab.binding.sensebox.internal;
|
||||
|
||||
import static org.openhab.binding.sensebox.internal.SenseBoxBindingConstants.THING_TYPE_BOX;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
@@ -37,7 +36,7 @@ import org.osgi.service.component.annotations.Component;
|
||||
@NonNullByDefault
|
||||
public class SenseBoxHandlerFactory extends BaseThingHandlerFactory {
|
||||
|
||||
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE_BOX);
|
||||
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_BOX);
|
||||
|
||||
@Override
|
||||
public boolean supportsThingType(ThingTypeUID thingTypeUID) {
|
||||
|
||||
@@ -59,7 +59,7 @@ public class SenseBoxSensor {
|
||||
public String getUnit() {
|
||||
// the uom library uses the 'MICRO SIGN', so if we encounter the GREEK SMALL LETTER MU,
|
||||
// replace it with the proper representation.
|
||||
return unit != null ? unit.replaceAll("\u03bc", "\u00b5") : "";
|
||||
return unit != null ? unit.replace("\u03bc", "\u00b5") : "";
|
||||
}
|
||||
|
||||
public void setUnit(String unit) {
|
||||
|
||||
@@ -102,9 +102,7 @@ public class SenseBoxHandler extends BaseThingHandler {
|
||||
}
|
||||
|
||||
if (senseBoxId != null && validConfig) {
|
||||
cache.put(CACHE_KEY_DATA, () -> {
|
||||
return connection.reallyFetchDataFromServer(senseBoxId);
|
||||
});
|
||||
cache.put(CACHE_KEY_DATA, () -> connection.reallyFetchDataFromServer(senseBoxId));
|
||||
updateStatus(ThingStatus.UNKNOWN);
|
||||
startAutomaticRefresh();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user