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:
Holger Friedrich
2023-09-13 08:03:31 +02:00
committed by GitHub
parent 641b482551
commit ab58f4ffb4
471 changed files with 1624 additions and 1868 deletions

View File

@@ -156,46 +156,46 @@ public class SonyProjectorHandler extends BaseThingHandler {
refreshChannel(CHANNEL_XVCOLOR, true);
break;
case CHANNEL_CONTRAST:
if (command instanceof DecimalType) {
connector.setContrast(((DecimalType) command).intValue());
} else if (command instanceof PercentType) {
connector.setContrast(((PercentType) command).intValue());
if (command instanceof DecimalType decimalCommand) {
connector.setContrast(decimalCommand.intValue());
} else if (command instanceof PercentType percentCommand) {
connector.setContrast(percentCommand.intValue());
} else {
throw new SonyProjectorException("Invalid command value");
}
break;
case CHANNEL_BRIGHTNESS:
if (command instanceof DecimalType) {
connector.setBrightness(((DecimalType) command).intValue());
} else if (command instanceof PercentType) {
connector.setBrightness(((PercentType) command).intValue());
if (command instanceof DecimalType decimalCommand) {
connector.setBrightness(decimalCommand.intValue());
} else if (command instanceof PercentType percentCommand2) {
connector.setBrightness(percentCommand2.intValue());
} else {
throw new SonyProjectorException("Invalid command value");
}
break;
case CHANNEL_COLOR:
if (command instanceof DecimalType) {
connector.setColor(((DecimalType) command).intValue());
} else if (command instanceof PercentType) {
connector.setColor(((PercentType) command).intValue());
if (command instanceof DecimalType decimalCommand) {
connector.setColor(decimalCommand.intValue());
} else if (command instanceof PercentType percentCommand3) {
connector.setColor(percentCommand3.intValue());
} else {
throw new SonyProjectorException("Invalid command value");
}
break;
case CHANNEL_HUE:
if (command instanceof DecimalType) {
connector.setHue(((DecimalType) command).intValue());
} else if (command instanceof PercentType) {
connector.setHue(((PercentType) command).intValue());
if (command instanceof DecimalType decimalCommand) {
connector.setHue(decimalCommand.intValue());
} else if (command instanceof PercentType percentCommand4) {
connector.setHue(percentCommand4.intValue());
} else {
throw new SonyProjectorException("Invalid command value");
}
break;
case CHANNEL_SHARPNESS:
if (command instanceof DecimalType) {
connector.setSharpness(((DecimalType) command).intValue());
} else if (command instanceof PercentType) {
connector.setSharpness(((PercentType) command).intValue());
if (command instanceof DecimalType decimalCommand) {
connector.setSharpness(decimalCommand.intValue());
} else if (command instanceof PercentType percentCommand5) {
connector.setSharpness(percentCommand5.intValue());
} else {
throw new SonyProjectorException("Invalid command value");
}
@@ -208,10 +208,10 @@ public class SonyProjectorHandler extends BaseThingHandler {
refreshChannel(CHANNEL_IRIS_MANUAL, true);
break;
case CHANNEL_IRIS_MANUAL:
if (command instanceof DecimalType) {
connector.setIrisManual(((DecimalType) command).intValue());
} else if (command instanceof PercentType) {
connector.setIrisManual(((PercentType) command).intValue());
if (command instanceof DecimalType decimalCommand) {
connector.setIrisManual(decimalCommand.intValue());
} else if (command instanceof PercentType percentCommand6) {
connector.setIrisManual(percentCommand6.intValue());
} else {
throw new SonyProjectorException("Invalid command value");
}