Xtend api documentation

Is there an api documentation that has every command and data type available to us in rules?

For instance, I used the split command to split a string into an “array”. In quotes because I’m not sure “array” is the correct term here. In fact, that’s part of my problem. Exactly what data type is returned by the split command? Is it correct to say that “I am using the Xtend split command”? What methods are available to me with that “array”?

When you call split, you are invoking String.split in the Java 1.8 API. xtend is essentially syntactical sugar of Java. You can use whatever classes in the Java standard lib.

Here’s the xtend doc: https://www.eclipse.org/xtend/documentation/203_xtend_expressions.html

The Rules DSL is a customized version of Xtend.

Xtend is a language that runs on the Java Runtime Environment and therefore has access to ALL that Java provides.

So, for the structure of your .rules files and things like triggers and the like look here.

For the general syntax of the language (e.g. variables, for loops, if statements, etc) go here. NOTE, Rules DSL is not Xtend and there are features in Xtend that are not supported like Classes and arrays.

For the Java stuff that is available see this.

For Actions (special functions created by OH for use in Rules) see this.

Xtend’s Collections operations (filter, forEach, et al) use Java’s Stream API. You can see how to use those in an OH Rule’s context in Design Pattern: Working with Groups in Rules.

2 Likes