TermToObjectConverter
Converts a Prolog Term into a JVM/Kotlin value -- the direction opposite to ObjectToTermConverter -- and drives the overload-resolution machinery (OverloadSelector) used to pick the right method/constructor/property to invoke for a given set of Prolog arguments.
A Term can be ambiguous with respect to which JVM/Kotlin type it should become (e.g. a Prolog integer could become a Long, an Int, a Short... or org.gciatto.kt.math.BigInteger): this converter enumerates all the admissibleTypes a term could be converted into, ranks how well each candidate priorityOfConversion fits (lower is better; null means "not admissible"), and exposes mostAdequateType as the best default guess -- which is what the parameterless convert uses.
ObjectRefs and null (via it.unibo.tuprolog.solve.libs.oop.NullRef) convert straightforwardly to their wrapped object (subject to a subtype check against the requested convertInto type); an explicit X as Type expression (it.unibo.tuprolog.solve.libs.oop.OOP.CAST_OPERATOR) or a dealiasing expression $Alias (resolved via the dealiaser passed to of) is honored too.
See also
Functions
Every JVM/Kotlin type term could reasonably be converted into.
The best (lowest-priority-value) type among admissibleTypes for term.
Eagerly converts term into every one of its admissibleTypes, in priority order.
How well term fits as an instance of type, lower being a better fit, or null if term cannot be converted into type at all. Used by OverloadSelector to rank candidate overloads.