Changes between Version 4 and Version 5 of JavaFfi


Ignore:
Timestamp:
11/04/10 21:17:12 (11 years ago)
Author:
astalla
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • JavaFfi

    v4 v5  
    99The core API is based on Java reflection. Some operators come in two flavors: a concise one that leaves some things to be computed by ABCL at runtime, and a more efficient and verbose one, which is mostly a direct translation of the Java reflection API.
    1010
     11=== Definitions ===
     12
     13  * ''Java class designator'': either a string denoting the fully qualified name of a Java class, such as "java.lang.String", or a Java class metaobject, that is, an instance of java.lang.Class, for example as returned by the function `jclass`.
     14  * ''Java method designator'': in the context of Java method invocations, either a Java method metaobject (an instance of java.lang.reflect.Method), or a string representing the name of the method, for example "toString".
     15
    1116=== Function JCALL, JCALL-RAW ===
    1217
    1318'''Syntax:'''
    1419
    15 '''jcall''' ''method instance &rest args => T''
    16 
    17 '''jcall-raw''' ''method instance &rest args => T''
     20'''jcall''' ''method instance &rest args => object''
     21
     22'''jcall-raw''' ''method instance &rest args => a JAVA-OBJECT''
    1823
    1924'''Arguments and Values:'''
     
    4449'''Syntax:'''
    4550
    46 '''jclass''' ''name-or-class-ref &optional class-loader => Java class metaobject''
     51'''jclass''' ''name-or-class-ref &optional class-loader => a Java class metaobject''
    4752
    4853'''Arguments and Values:'''
    4954
    50 `name-or-class-ref` -- a Java class designator, that is, a Java class metaobject (an instance of java.lang.Class), or a string representing the fully qualified name of the Java class, for example "java.lang.Object".
     55`name-or-class-ref` -- a Java class designator (see [#Definitions Definitions]).
    5156
    5257`class-loader` -- the classloader to use to resolve the class. Refer to the section Class resolution and loading.
     
    5964
    6065`(jclass "java.util.LinkedList") => #<java.lang.Class class java.util.LinkedList {11B50A1}>`
     66
     67=== Function JSTATIC, JSTATIC-RAW ===
     68
     69'''Syntax:'''
     70
     71'''jstatic''' ''method class &rest args => object''
     72
     73'''jstatic-raw''' ''method class &rest args => JAVA-OBJECT''
     74
     75'''Arguments and Values:'''
     76
     77`method` -- a Java method designator.
     78
     79`class` -- a Java class metaobject.
     80
     81`args` -- the arguments passed to the method.
     82
     83'''Description:'''
     84
     85Reflectively calls a static method and returns the result of the call. `(jstatic method class args)` is equivalent to `(jcall (jmethod class method) nil args)` when `method` is a string, and to `(jcall method nil args)` when `method` is a Java method metaobject (class is thus ignored in that case). Similarly for the `-raw` variants.
     86
     87`jstatic` translates the result to a Lisp object if possible. `jstatic-raw` performs no translation and always returns the original Java object.
     88
     89'''Examples:'''
     90
     91{{{
     92(jstatic "getRuntime" "java.lang.Runtime") => #<java.lang.Runtime java.lang.Runtime@1ef3212 {C07527}>
     93(jstatic-raw "getRuntime" "java.lang.Runtime") => #<java.lang.Runtime java.lang.Runtime@1ef3212 {156D7C8}>
     94(jstatic "getRuntime" (jclass "java.lang.Runtime")) => #<java.lang.Runtime java.lang.Runtime@1ef3212 {C8E4DE}>
     95(jstatic (jmethod "java.lang.Runtime" "getRuntime") nil) => #<java.lang.Runtime java.lang.Runtime@1ef3212 {129DF8A}>
     96}}}
    6197
    6298== Class resolution and loading ==