[utils] javaify/jsify: Handle wrapped openHAB types - #550
Conversation
Signed-off-by: Ravi Nadahar <nadahar@rediffmail.com>
|
@florian-h05 It fails on tests, but the errors seem to be unrelated to what I've done, so I'm not sure what to do about it. edit: Perhaps it's some circular dependency issue? I really don't know how the files are organized, so I don't know to figure it if that's the case, or how to solve it. |
Signed-off-by: Ravi Nadahar <nadahar@rediffmail.com>
|
I moved the problematic "requires" inside the function. If that's not kosher, I think these functions must reside somewhere else than in |
| return val; | ||
| } | ||
|
|
||
| // Note: Inline requires are used here to prevent circular dependencies during startup, as utils.js is imported by these very classes. |
There was a problem hiding this comment.
Unfortunately I have no better idea how to handle this ...
IMO it is desirable. |
|
If you think it looks good as it is, there's no need for me to do anything more - but let's check if there's anything more we have forgotten. What about the "event object"? It's not entirely clear to me how that is handled and if it's even relevant to pass it on. |
|
The way I read the code, If so, it means that we have JS rules that both deal with the |
The event object is a "simple" object of key value pairs, so javaify will make it a Map. As GraalJS allows for
It is also invoked for "standard" rules (ScriptModuleHandler-based ones), it is done through code injection inside the add-on there: What's executed in ScriptModuleHandler cannot be wrapper like done with the execute callback for SimpleRules, so we have to convert the event object through a different path. |
javaify/jsify: Handle wrapped OH types
javaify/jsify: Handle wrapped OH typesjavaify/jsify: Handle wrapped openHAB types
I don't have the overview, so I've only handled the types I could find by searching the code. I'm a bit unsure about the
Quantity⇄QuantityTypeconversion, and if that really is desirable..?Anyway, any other wrapped types that I've missed should be added as well, but this shows "the principle" of how I think these should be handled.