Java 17 features (H-M) (#15520)
- 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 - remove null check before instanceof Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
@@ -174,9 +174,8 @@ public class IntesisBoxHandler extends BaseThingHandler implements IntesisBoxCha
|
||||
}
|
||||
break;
|
||||
case CHANNEL_TYPE_TARGETTEMP:
|
||||
if (command instanceof QuantityType) {
|
||||
QuantityType<?> celsiusTemperature = (QuantityType<?>) command;
|
||||
celsiusTemperature = celsiusTemperature.toUnit(SIUnits.CELSIUS);
|
||||
if (command instanceof QuantityType quantityCommand) {
|
||||
QuantityType<?> celsiusTemperature = quantityCommand.toUnit(SIUnits.CELSIUS);
|
||||
if (celsiusTemperature != null) {
|
||||
double doubleValue = celsiusTemperature.doubleValue();
|
||||
logger.trace("targetTemp double value = {}", doubleValue);
|
||||
|
||||
@@ -194,8 +194,7 @@ public class IntesisHomeHandler extends BaseThingHandler {
|
||||
break;
|
||||
case CHANNEL_TYPE_TARGETTEMP:
|
||||
uid = 9;
|
||||
if (command instanceof QuantityType) {
|
||||
QuantityType<?> newVal = (QuantityType<?>) command;
|
||||
if (command instanceof QuantityType newVal) {
|
||||
newVal = newVal.toUnit(SIUnits.CELSIUS);
|
||||
if (newVal != null) {
|
||||
value = newVal.intValue() * 10;
|
||||
@@ -226,7 +225,7 @@ public class IntesisHomeHandler extends BaseThingHandler {
|
||||
if (data != null) {
|
||||
Id id = gson.fromJson(data.id, Id.class);
|
||||
if (id != null) {
|
||||
sessionId[0] = id.sessionID.toString();
|
||||
sessionId[0] = id.sessionID;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -241,8 +240,7 @@ public class IntesisHomeHandler extends BaseThingHandler {
|
||||
|
||||
public @Nullable String logout(String sessionId) {
|
||||
String contentString = "{\"command\":\"logout\",\"data\":{\"sessionID\":\"" + sessionId + "\"}}";
|
||||
String response = api.postRequest(config.ipAddress, contentString);
|
||||
return response;
|
||||
return api.postRequest(config.ipAddress, contentString);
|
||||
}
|
||||
|
||||
public void populateProperties() {
|
||||
@@ -490,7 +488,7 @@ public class IntesisHomeHandler extends BaseThingHandler {
|
||||
switch (element.uid) {
|
||||
case 1:
|
||||
updateState(CHANNEL_TYPE_POWER,
|
||||
String.valueOf(element.value).equals("0") ? OnOffType.OFF : OnOffType.ON);
|
||||
"0".equals(String.valueOf(element.value)) ? OnOffType.OFF : OnOffType.ON);
|
||||
break;
|
||||
case 2:
|
||||
switch (element.value) {
|
||||
@@ -554,7 +552,7 @@ public class IntesisHomeHandler extends BaseThingHandler {
|
||||
break;
|
||||
case 14:
|
||||
updateState(CHANNEL_TYPE_ERRORSTATUS,
|
||||
String.valueOf(element.value).equals("0") ? OnOffType.OFF : OnOffType.ON);
|
||||
"0".equals(String.valueOf(element.value)) ? OnOffType.OFF : OnOffType.ON);
|
||||
break;
|
||||
case 15:
|
||||
updateState(CHANNEL_TYPE_ERRORCODE, StringType.valueOf(String.valueOf(element.value)));
|
||||
|
||||
Reference in New Issue
Block a user