This module provides predicates to automatically turn a Prolog text into a Java class. The Java class will be a Java proxy class generated for a set of interfaces. The set of interfaces is collected from the re-exported auto loaded Java classes of the given Prolog text. The Java proxy class is generated when an instance of the Java proxy class is requested by the predi-cate sys_new_instance/2:Example:
:- module(mycomparator, ).
:- public new/1.
new(X) :- sys_new_instance(mycomparator, X). % define the constructor
:- override compare/4.
:- public compare/4.
compare(_, X, Y, R) :- ... % define the method
The predicate and evaluable functions of the Prolog text will be used for the execution of the methods on the Java proxy instance. Only methods that belong to the set of interfaces can be invoked directly from Java on the Java proxy instances. If the set of interfaces contains the Java interface InterfaceSlots the proxy instances should be created with the predicate sys_new_instance/3 instead of the predicate sys_new_instance/2.Example:
?- sys_subclass_of(java/util/'Comparator', mycomparator).
?- mycomparator:new(X), sys_instance_of(X, java/util/'Comparator').
X = 0r709d5f9e
?- mycomparator:new(X), X::compare(7,7,Y).
X = 0r43dd69,
Y = 0
The re-export chain of Prolog modules and auto loaded Java
classes defines a module tax-onomy. The module taxonomy can be
tested by the predicate sys_assignable_from/2, which checks
whether one module is derived from another module. Further Java
Prolog proxy in-stances, instances directly created from within
Java and Prolog callables can be tested with the predicate
The following proxy predicates are provided: