A mechanism to extend MINERVA on-the-fly with functionality given in Java classes.
The use of reflection is an alternative to the static addition of Java extensions to MINERVA via minervax.
Semantics:
Generating a MINERVA predicate from a Java method object, the follwing holds:
static void fun(X, Y) => fun(X, Y) void fun(X, Y) => fun(Object, X, Y) static boolean fun(X, Y) => fun(X, Y) boolean fun(X, Y) => fun(Object, X, Y) static int fun(X, Y) => fun(X, Y, Result) int fun(X, Y) => fun(Object, X, Y, Result)The predicate invoke_method/4 can be used to directly invoke a method, i.e. without using declare_method/2.
invoke_method(+Method, +Object, +ArgumentList, -Result)Example:
:
get_class('java.lang.String', String),
get_class(int, Integer),
get_method(String, substring, [Integer,Integer], Substring),
invoke_method(Substring, hello, [1,4], Result).
==>
Result = ell
For more usage examples refer to the ExamplePrograms section.