The following table lists the possible values of arguments of the
argument type specification to jasper_call/4
and
jasper_new_object/5
(see Jasper Library Predicates). The
value specifies which conversion between corresponding Prolog
argument and Java type will take place.
There is currently no mechanism for specifying Java arrays in this way.
In the following the package prefix (java/lang
or
se/sics/jasper
) has been left out for brevity.
For several of the numerical types there is the possibility that the target type cannot accurately represent the source type, e.g. when converting from a Prolog integer to a Java byte. The behavior in such cases is unspecified.
Prolog: +integer
Java: int
int
, a 32 bit signed integer.
Prolog: +byte
Java: byte
byte
.
Prolog: +short
Java: short
short
, a 16 bit signed integer.
Prolog: +long
Java: long
long
, a 64-bit signed integer.
In SICStus versions prior to 3.9.1, the value was truncated to 32 bits
when passed between Java and Prolog. This is no longer the case.
Prolog: +float
Java: float
float
.
Prolog: +double
Java: double
double
.
Prolog: +term
Java: SPTerm
SPTerm
.
Prolog: +object(
Class)
Java:
Class
Class
.
Prolog: +atom
obsolescent
Java: SPCanonicalAtom
SPCanonicalAtom
. Often +string
,
see below, is more useful.
Prolog: +boolean
Java: boolean
true
,false
}. The Java method will receive a
boolean
.
Prolog: +chars
Java: String
String
.
Prolog: +string
Java: String
String
.
Prolog: -atom
obsolescent
Java: SPTerm
SPTerm
, which
should be set to an atom (e.g. using
SPTerm.putString
). The argument will be bound to the
value of the atom when the method returns. Often -term
, see
below, is more useful.
Prolog: -chars
Java: StringBuffer
StringBuffer
, which can be modified. The argument will be
bound to a code-list of the StringBuffer
object.
Prolog: -string
Java: StringBuffer
StringBuffer
,
which can be modified. The argument will be bound to an
atom converted from the StringBuffer
object.
Prolog: -term
Java: SPTerm
SPTerm
, which can
be set to a term (e.g. using SPTerm.consFunctor
). The
argument will be bound to the term when the method
returns.
Prolog: [-integer]
Java: int
M()
int
. The value will be converted
to a Prolog integer.
Prolog: [-byte]
Java: byte
M()
byte
. The value will be converted
to a Prolog integer.
Prolog: [-short]
Java: short
M()
short
. The value will be converted
to a Prolog integer.
Prolog: [-long]
Java: long
M()
long
, a 64 bit signed integer.
The value will be converted to a Prolog integer.
Prolog: [-float]
Java: float
M()
float
. The value will be converted
to a Prolog float.
Prolog: [-double]
Java: double
M()
double
. The value will be converted
to a Prolog float.
Prolog: [-term]
Java: SPTerm
M()
SPTerm
, which
will be converted to a Prolog term.
Prolog: [-object(
Class)]
Java: SPTerm
M()
Prolog: [-atom]
obsolescent
Java: SPTerm
M()
SPCanonicalAtom
,
which will be converted to a Prolog atom. Often [-term]
,
see above, is more useful.
Prolog: [-boolean]
Java: boolean
M()
boolean
. The value will be converted to
a Prolog atom in {true
,false
}.
Prolog: [-chars]
Java: String
M()
String
, which
will be converted to a code-list.
Prolog: [-string]
Java: String
M()
String
, which
will be converted to an atom.