[armedbear-devel] Using Java Libraries
nitralime
nitralime at googlemail.com
Mon Oct 19 13:34:17 UTC 2009
Thank you for this quick "cheet sheet".
I find it very sad that there are no reasonable
documentation (at least something like a jump start guide).
Diving into source code maybe the last resort
for experts which I don't belong anyway!
Regards
Nik
On Mon, Oct 19, 2009 at 2:41 PM, Alessio Stalla <alessiostalla at gmail.com>wrote:
> On Mon, Oct 19, 2009 at 1:48 PM, nitralime <nitralime at googlemail.com>
> wrote:
> > Hi folks,
> >
> > I'm searching for a (more systematic) documentation (or tutorial)
> > about how to use Java libraries from ABCL.
> >
> > I couldn't find anything else except the examples on
> > "http://trac.common-lisp.net/armedbear/browser/trunk/abcl/examples/abcl
> ".
> >
> > Is there any such tutorial (or documentation) at all?
>
> I'm not aware of any tutorial, however if you know the Java reflection
> API you'll find that abcl's operators maps quite well to it. A quick
> "cheat sheet":
>
> (jclass <class name>) gives you a Java class
> (jmethod <java class> <method names> <&rest argument types>) gives you a
> method
> (jconstructor <java class> <&rest argument types>) a constructor
>
> (jnew <constructor> <&rest arguments>) instantiates a new Java object
> (jcall <method> <object> <&rest arguments>) calls a method
>
> then there's jstatic to access static fields and methods, and iirc
> jfield to access fields. Oh, and jproperty-value and (setf
> jproperty-value) to access "properties" following the Java Bean
> convention (setXXX and getXXX). That's almost all; there is some more
> advanced stuff (e.g. manipulating Java arrays).
>
> You can find most or all of this stuff inside Java.java
> (
> http://trac.common-lisp.net/armedbear/browser/trunk/abcl/src/org/armedbear/lisp/Java.java
> ).
> It's not documented but quite readable.
>
> Also, there's an "invoke.lisp" somewhere on the net which simplifies
> the Java API (at the cost of some more runtime reflection). IIRC it
> depends on a non-abcl Java class. I also wrote my own ad-hoc
> NIH-syndrome-influenced Java simplification layer which is less
> powerful but does not depend on external stuff.
>
> hth,
> Alessio
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/armedbear-devel/attachments/20091019/4d2cdbfd/attachment.html>
More information about the armedbear-devel
mailing list