DPT dpt = translator.getType();
// check for HSBType first, because it extends PercentType as well
- if (value instanceof HSBType) {
- return handleHSBType(dptId, (HSBType) value);
+ if (value instanceof HSBType type) {
+ return handleHSBType(dptId, type);
} else if (value instanceof OnOffType) {
return OnOffType.OFF.equals(value) ? dpt.getLowerValue() : dpt.getUpperValue();
} else if (value instanceof UpDownType) {
return OpenClosedType.CLOSED.equals(value) ? dpt.getLowerValue() : dpt.getUpperValue();
} else if (value instanceof StopMoveType) {
return StopMoveType.STOP.equals(value) ? dpt.getLowerValue() : dpt.getUpperValue();
- } else if (value instanceof PercentType) {
- int intValue = ((PercentType) value).intValue();
+ } else if (value instanceof PercentType type) {
+ int intValue = type.intValue();
return "251.600".equals(dptId) ? String.format("- - - %d %%", intValue) : String.valueOf(intValue);
} else if (value instanceof DecimalType || value instanceof QuantityType<?>) {
return handleNumericTypes(dptId, mainNumber, dpt, value);
} else if (value instanceof StringType) {
return value.toString();
- } else if (value instanceof DateTimeType) {
- return handleDateTimeType(dptId, (DateTimeType) value);
+ } else if (value instanceof DateTimeType type) {
+ return handleDateTimeType(dptId, type);
}
} catch (KNXException e) {
return null;
if (oldFuture != null) {
oldFuture.cancel(true);
}
- if (value instanceof IncreaseDecreaseType) {
+ if (value instanceof IncreaseDecreaseType type) {
channelFutures.put(channelUID, scheduler.scheduleWithFixedDelay(
- () -> postCommand(channelUID, (Command) value), 0, frequency, TimeUnit.MILLISECONDS));
+ () -> postCommand(channelUID, type), 0, frequency, TimeUnit.MILLISECONDS));
}
} else {
if (value instanceof Command command) {