Changes between Version 5 and Version 6 of JavaFfi


Ignore:
Timestamp:
11/04/10 21:31:14 (13 years ago)
Author:
astalla
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • JavaFfi

    v5 v6  
    77== The basics ==
    88
    9 The 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.
     9The 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. All the operators that pass arguments to Java code can receive arbitrary Lisp objects, that will be automatically translated to appropriate Java objects when applicable (technically, by calling javaInstance() on them). For example, Lisp strings are translated to instances of java.lang.String.
    1010
    1111=== Definitions ===
     
    1313  * ''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`.
    1414  * ''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  * ''Java constructor designator'': in the context of Java object instantiations, either a Java constructor metaobject, or a Java class designator.
    1516
    1617=== Function JCALL, JCALL-RAW ===
     
    4546}}}
    4647
    47 === Function JCLASS ===
    48 
    49 '''Syntax:'''
    50 
    51 '''jclass''' ''name-or-class-ref &optional class-loader => a Java class metaobject''
    52 
    53 '''Arguments and Values:'''
    54 
    55 `name-or-class-ref` -- a Java class designator (see [#Definitions Definitions]).
    56 
    57 `class-loader` -- the classloader to use to resolve the class. Refer to the section Class resolution and loading.
    58 
    59 '''Description:'''
    60 
    61 Returns a reference to the Java class designated by `name-or-class-ref`. If the `class-loader` parameter is passed, the class is resolved with respect to the given ClassLoader.
    62 
    63 '''Examples:'''
    64 
    65 `(jclass "java.util.LinkedList") => #<java.lang.Class class java.util.LinkedList {11B50A1}>`
    66 
    6748=== Function JSTATIC, JSTATIC-RAW ===
    6849
     
    9576(jstatic (jmethod "java.lang.Runtime" "getRuntime") nil) => #<java.lang.Runtime java.lang.Runtime@1ef3212 {129DF8A}>
    9677}}}
     78
     79=== Function JNEW ===
     80
     81'''Syntax:'''
     82
     83'''jnew''' ''constructor &rest args => JAVA-OBJECT''
     84
     85'''Arguments and Values:'''
     86
     87`constructor` -- a Java constructor designator (see [#Definitions Definitions]).
     88
     89`args` -- the arguments passed to the constructor.
     90
     91'''Description:'''
     92
     93Returns a new Java object created calling the specified constructor with the specified arguments. If `constructor` is a Java constructor metaobject, it will be called directly. If it is a Java class designator, the most specific constructor with respect to `args` will be searched in that class.
     94
     95'''Examples:'''
     96
     97{{{
     98(jnew "java.lang.String" "foo") => #<java.lang.String foo {1E5BA24}>
     99(jnew (jclass "java.lang.String") "foo") => #<java.lang.String foo {1E5BA24}>
     100(jnew (jconstructor "java.lang.String" "java.lang.String") "foo") => #<java.lang.String foo {1E5BA24}>
     101}}}
     102
     103=== Function JCLASS ===
     104
     105'''Syntax:'''
     106
     107'''jclass''' ''name-or-class-ref &optional class-loader => a Java class metaobject''
     108
     109'''Arguments and Values:'''
     110
     111`name-or-class-ref` -- a Java class designator (see [#Definitions Definitions]).
     112
     113`class-loader` -- the classloader to use to resolve the class. Refer to the section Class resolution and loading.
     114
     115'''Description:'''
     116
     117Returns a reference to the Java class designated by `name-or-class-ref`. If the `class-loader` parameter is passed, the class is resolved with respect to the given ClassLoader.
     118
     119'''Examples:'''
     120
     121`(jclass "java.util.LinkedList") => #<java.lang.Class class java.util.LinkedList {11B50A1}>`
     122
    97123
    98124== Class resolution and loading ==