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:
@@ -141,7 +141,7 @@ public class Car {
|
||||
JsonObject attributes = getAttributes(responseJson);
|
||||
if (attributes != null) {
|
||||
if (attributes.get("hvacStatus") != null) {
|
||||
hvacstatus = attributes.get("hvacStatus").getAsString().equals("on");
|
||||
hvacstatus = "on".equals(attributes.get("hvacStatus").getAsString());
|
||||
}
|
||||
if (attributes.get("externalTemperature") != null) {
|
||||
externalTemperature = attributes.get("externalTemperature").getAsDouble();
|
||||
@@ -207,13 +207,12 @@ public class Car {
|
||||
String url = null;
|
||||
for (JsonElement asset : assetsJson) {
|
||||
if (asset.getAsJsonObject().get("assetType") != null
|
||||
&& asset.getAsJsonObject().get("assetType").getAsString().equals("PICTURE")) {
|
||||
&& "PICTURE".equals(asset.getAsJsonObject().get("assetType").getAsString())) {
|
||||
if (asset.getAsJsonObject().get("renditions") != null) {
|
||||
JsonArray renditions = asset.getAsJsonObject().get("renditions").getAsJsonArray();
|
||||
for (JsonElement rendition : renditions) {
|
||||
if (rendition.getAsJsonObject().get("resolutionType") != null
|
||||
&& rendition.getAsJsonObject().get("resolutionType").getAsString()
|
||||
.equals("ONE_MYRENAULT_SMALL")) {
|
||||
if (rendition.getAsJsonObject().get("resolutionType") != null && "ONE_MYRENAULT_SMALL"
|
||||
.equals(rendition.getAsJsonObject().get("resolutionType").getAsString())) {
|
||||
url = rendition.getAsJsonObject().get("url").getAsString();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -277,7 +277,6 @@ public class MyRenaultHttpSession {
|
||||
|
||||
public void actionPause(boolean mode) throws RenaultForbiddenException, RenaultNotImplementedException,
|
||||
RenaultActionException, RenaultAPIGatewayException {
|
||||
|
||||
final String apiMode = mode ? "pause" : "resume";
|
||||
final String path = "/commerce/v1/accounts/" + kamereonaccountId + "/kamereon/kcm/v1/vehicles/" + config.vin
|
||||
+ "/charge/pause-resume?country=" + getCountry(config);
|
||||
|
||||
@@ -123,15 +123,14 @@ public class RenaultHandler extends BaseThingHandler {
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
|
||||
switch (channelUID.getId()) {
|
||||
case RenaultBindingConstants.CHANNEL_HVAC_TARGET_TEMPERATURE:
|
||||
if (!car.isDisableHvac()) {
|
||||
if (command instanceof RefreshType) {
|
||||
updateState(CHANNEL_HVAC_TARGET_TEMPERATURE,
|
||||
new QuantityType<Temperature>(car.getHvacTargetTemperature(), SIUnits.CELSIUS));
|
||||
} else if (command instanceof DecimalType) {
|
||||
car.setHvacTargetTemperature(((DecimalType) command).doubleValue());
|
||||
} else if (command instanceof DecimalType decimalCommand) {
|
||||
car.setHvacTargetTemperature(decimalCommand.doubleValue());
|
||||
updateState(CHANNEL_HVAC_TARGET_TEMPERATURE,
|
||||
new QuantityType<Temperature>(car.getHvacTargetTemperature(), SIUnits.CELSIUS));
|
||||
} else if (command instanceof QuantityType) {
|
||||
|
||||
Reference in New Issue
Block a user