Annotation Interface Binding
Binding names are concatenated with dots (.) to access nested types, methods or fields.
For example, if you have a class named Foo with a
field named bar and a method named baz, you
can bind them as follows:
@Binding("foo")
class Foo {
@Binding("baz")
public static int baz = 0;
@Binding("bar")
public static void bar() {}
}
Then, you can access them from Molang scripts as follows:
foo.baz
foo.bar()
Note that for non-static bindings, the instance name will be used instead.
A class annotated with Binding can also implement
- Since:
- 3.0.0
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionboolean(For methods only) Determines if this method is pure or not.booleanReturns whether this binding should be skipped from the binding checking/normalizing process.
-
Element Details
-
value
Returns the names for this binding.- Returns:
- The names for this binding.
- Since:
- 3.0.0
-
-
-
skipChecking
boolean skipCheckingReturns whether this binding should be skipped from the binding checking/normalizing process.For example, functions that return a double value must be checked in order to replace NaN and Infinity values by zero. If a function already does that, then it can be skipped from the automatic process.
- Returns:
- Whether this binding should be skipped from the binding checking/normalizing process.
- Since:
- 3.0.0
- Default:
- false
-
pure
boolean pure(For methods only) Determines if this method is pure or not.A pure method is a method that has the following properties:
- The method return values are identical for identical arguments, and
- The method has no side effects
The compiler or interpreter may pre-evaluate these functions ahead of time. In case of compiling, the function may be called during compile time, to use the function's result instead.
- Returns:
- If this function is pure or not.
- Since:
- 3.0.0
- Default:
- false
-