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:
@@ -12,7 +12,6 @@
|
||||
*/
|
||||
package org.openhab.binding.bluetooth.roaming.internal;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
@@ -32,7 +31,7 @@ public class RoamingBindingConstants {
|
||||
public static final ThingTypeUID THING_TYPE_ROAMING = new ThingTypeUID(BluetoothBindingConstants.BINDING_ID,
|
||||
"roaming");
|
||||
|
||||
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE_ROAMING);
|
||||
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_ROAMING);
|
||||
|
||||
public static final String CONFIGURATION_GROUP_ADAPTER_UIDS = "groupUIDs";
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ public class RoamingBridgeHandler extends BaseBridgeHandler implements RoamingBl
|
||||
return false;
|
||||
}
|
||||
Object discovery = getConfig().get(BluetoothBindingConstants.CONFIGURATION_DISCOVERY);
|
||||
return !(discovery != null && discovery.toString().equalsIgnoreCase("false"));
|
||||
return !(discovery != null && "false".equalsIgnoreCase(discovery.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.util.Map;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.bluetooth.BluetoothAdapter;
|
||||
import org.openhab.core.thing.Bridge;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.thing.ThingTypeUID;
|
||||
@@ -69,8 +68,8 @@ public class RoamingHandlerFactory extends BaseThingHandlerFactory {
|
||||
|
||||
@Override
|
||||
protected synchronized void removeHandler(ThingHandler thingHandler) {
|
||||
if (thingHandler instanceof RoamingBluetoothAdapter) {
|
||||
UID uid = ((BluetoothAdapter) thingHandler).getUID();
|
||||
if (thingHandler instanceof RoamingBluetoothAdapter bluetoothAdapter) {
|
||||
UID uid = bluetoothAdapter.getUID();
|
||||
ServiceRegistration<?> serviceReg = this.serviceRegs.remove(uid);
|
||||
if (serviceReg != null) {
|
||||
serviceReg.unregister();
|
||||
|
||||
Reference in New Issue
Block a user