Sorry for the really basic question, but I am trying to understand how to refer to things like:
org.openhab.core.types.State and java.nio.file.Path
that are found in places like : (JSR223 Scripting | openHAB)
I believe they are Java classes and inheritance related … Can someone point me to a description of this concept in general? I want to know how to properly refer to these and understand the significance to Openhab in particular.
It’s hard to search for this when I have no idea how to refer to it
JSR223 languages, which at this point are all the languages supported by OH 3 now, are running on the Java Virtual Machine.
openHAB is written in Java.
All interactions between openHAB and a rule, no matter what language that rule is written in, takes place through Java Classes and Objects. Furthermore, and Class or Object that is a part of the core Java language, part of openHAB itself, and I think is part of a library used by openHAB itself are available to be imported, instantiated and used in an openHAB rule.
Any time you see a class name that starts with “org.openhab” you are looking at a Java Class defined by openHAB. You can find the JavaDocs for those at Overview (openHAB Core 3.1.0-SNAPSHOT API)
Any time you see a class name that starts with “java” or “javax” you are looking at a Class that is core to the Java language. You can find the JavaDocs for those at Overview (Java SE 11 & JDK 11 ).
The “magic” of JSR223 is that it allows you to import and use these Java Classes and Objects in what ever language you are using as if they were actually written in those languages. So, for example, you can import and use the core Java java.time.ZonedDateTime to create an openHAB Timer using the openHAB Java class
org.openhab.core.model.script.actions.ScriptExecution the same as you would call any other function on any other native Python Object in a JSR223 Python rule.
One thing that the Helper Libraries is to make this bridging between Java and native Python a little more transparent.
Thanks Rich - Excellent description (as usual) … so basically when I know which Java class a particular object is located, I can do an
importPreset … but for the predefined sets in Openhab, all of those come with the single import … got it. Thanks!