[jssscripting] Fix JS Quantity to Java QuantityType conversion (#16106)

Regression from https://github.com/openhab/openhab-js/pull/312.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
This commit is contained in:
Florian Hotze 2023-12-25 15:09:00 +01:00 committed by Jacob Laursen
parent 79a2c21202
commit 2fd46961fc

View File

@ -125,8 +125,8 @@ public class OpenhabGraalJSScriptEngine
v -> v.getMember("rawItem").as(Item.class), HostAccess.TargetMappingPrecedence.LOW)
// Translate openhab-js Quantity to org.openhab.core.library.types.QuantityType
.targetTypeMapping(Value.class, QuantityType.class, v -> v.hasMember("raw") && v.hasMember("toUnit"),
v -> v.getMember("raw").as(QuantityType.class), HostAccess.TargetMappingPrecedence.LOW)
.targetTypeMapping(Value.class, QuantityType.class, v -> v.hasMember("rawQtyType"),
v -> v.getMember("rawQtyType").as(QuantityType.class), HostAccess.TargetMappingPrecedence.LOW)
.build();
/** {@link Lock} synchronization of multi-thread access */