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.oppo.internal;
|
||||
|
||||
import static org.openhab.binding.oppo.internal.OppoBindingConstants.*;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
@@ -39,7 +38,7 @@ import org.osgi.service.component.annotations.Reference;
|
||||
@NonNullByDefault
|
||||
@Component(configurationPid = "binding.oppo", service = ThingHandlerFactory.class)
|
||||
public class OppoHandlerFactory extends BaseThingHandlerFactory {
|
||||
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE_PLAYER);
|
||||
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_PLAYER);
|
||||
|
||||
private final SerialPortManager serialPortManager;
|
||||
|
||||
@@ -62,9 +61,7 @@ public class OppoHandlerFactory extends BaseThingHandlerFactory {
|
||||
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
|
||||
|
||||
if (SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID)) {
|
||||
OppoHandler handler = new OppoHandler(thing, stateDescriptionProvider, serialPortManager);
|
||||
|
||||
return handler;
|
||||
return new OppoHandler(thing, stateDescriptionProvider, serialPortManager);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ import org.slf4j.LoggerFactory;
|
||||
@NonNullByDefault
|
||||
@Component(service = DiscoveryService.class, configurationPid = "discovery.oppo")
|
||||
public class OppoDiscoveryService extends AbstractDiscoveryService {
|
||||
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE_PLAYER);
|
||||
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_PLAYER);
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(OppoDiscoveryService.class);
|
||||
|
||||
|
||||
@@ -268,8 +268,8 @@ public class OppoHandler extends BaseThingHandler implements OppoMessageEventLis
|
||||
}
|
||||
break;
|
||||
case CHANNEL_SOURCE:
|
||||
if (command instanceof DecimalType) {
|
||||
int value = ((DecimalType) command).intValue();
|
||||
if (command instanceof DecimalType decimalCommand) {
|
||||
int value = decimalCommand.intValue();
|
||||
connector.sendCommand(OppoCommand.SET_INPUT_SOURCE, String.valueOf(value));
|
||||
}
|
||||
break;
|
||||
@@ -297,14 +297,14 @@ public class OppoHandler extends BaseThingHandler implements OppoMessageEventLis
|
||||
}
|
||||
break;
|
||||
case CHANNEL_SUB_SHIFT:
|
||||
if (command instanceof DecimalType) {
|
||||
int value = ((DecimalType) command).intValue();
|
||||
if (command instanceof DecimalType decimalCommand) {
|
||||
int value = decimalCommand.intValue();
|
||||
connector.sendCommand(OppoCommand.SET_SUBTITLE_SHIFT, String.valueOf(value));
|
||||
}
|
||||
break;
|
||||
case CHANNEL_OSD_POSITION:
|
||||
if (command instanceof DecimalType) {
|
||||
int value = ((DecimalType) command).intValue();
|
||||
if (command instanceof DecimalType decimalCommand) {
|
||||
int value = decimalCommand.intValue();
|
||||
connector.sendCommand(OppoCommand.SET_OSD_POSITION, String.valueOf(value));
|
||||
}
|
||||
break;
|
||||
@@ -843,7 +843,7 @@ public class OppoHandler extends BaseThingHandler implements OppoMessageEventLis
|
||||
if (model == MODEL83 || model == MODEL103 || model == MODEL105) {
|
||||
hdmiModeOptions.add(new StateOption("AUTO", "Auto"));
|
||||
hdmiModeOptions.add(new StateOption("SRC", "Source Direct"));
|
||||
if (!(model == MODEL83)) {
|
||||
if (model != MODEL83) {
|
||||
hdmiModeOptions.add(new StateOption("4K2K", "4K*2K"));
|
||||
}
|
||||
hdmiModeOptions.add(new StateOption("1080P", "1080P"));
|
||||
|
||||
Reference in New Issue
Block a user