User Tools

Site Tools


01_user_documentation:07_rgg_xl:02_xl:09_java_addition:implicit_conversion

Implicit conversions

It is possible to convert object and primitive into other objects implicitly. By default, the only implicit conversions enabled are the boxing and unboxing of primitive (e.g. from Integer to int) and RGG files also automatically include the Float to Double implicit conversion.

It is possible to declare additional conversions by defining the appropriate method or constructor. However, if more that one conversion between to object is available, the conversion is ambiguous and results in an error.

Constructor

A class, or module can declare a constructor with the annotation @ConversionConstructor. That constructor will be used by default if the object is created from an object from the arguments of that constructor.

→ Read more...

Method

The conversion can be declared as a method between to classes. It is possible to declare this method on either of the two class for either of the conversion side. E.g. to convert A to B it is possible to declare a method in A, or in B, that define how A should be converted.

→ Read more...

To Node

Object can also be automatically converted to Nodes. Which can happen in a production statement. By default, Objects are wrapped into a ObjectNode if added to a graph. But, it is possible to declare a specific conversion method.

→ Read more...

01_user_documentation/07_rgg_xl/02_xl/09_java_addition/implicit_conversion.txt · Last modified: 2025/08/20 10:32 by gaetan