Macro | Package: net.jlinker | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version

## def-java-to-lisp-wrapper

Arguments: class-name (&key lisp-supers static-slots java-slots lisp-slots java-file if-exists verbose connector) &rest java-methods

Evaluate `(require :jlinkent)` to load this functionality.

This macro generates an output file with Java code that defines a Java class. This macro also generates Lisp code corresponding to the Java class. See examples/jlinker/javabean/bean1gen.cl.

The arguments are:

- class-name: a symbol or a list:
  - `name`
  - `(name name () :public)`

        (lisp-name java-name
                   (java-super java-interface ... )
                   java-flag ... )

- lisp-supers: `(lisp-superclass ... )`
- static-slots: a symbol or a list:
  - `name`
  - `((name name :type :int :flags (:public :static)))`
  - `(slot-name accessor ... )`
- java-slots: a symbol or a list:
  - `name`
  - `((name name :type :int :flags (:public)))`
  - `(slot-name accessor ... )`
- slot-name: `(lisp-name java-name JiL-slot-def... )`
- lisp-slots: `(clos-slot-def ... )`
- java-file: `path-string OR T OR :none`
- if-exists: `:supersede OR :append OR nil`
- connector: `a JiL expression to test connection to Lisp. Default: ("LispConnector.go" |false| |null|)`
- java-methods: `java-method` .... See below.

A `java-method` is either a `lisp-and-java-name` or a list with the following elements:

    (method-name
     ([java-arg-type] ... )
     [java-return-type [java-flag] ... [result-modifier]])

The elements are:

- method-name: a list `(lisp-name java-name)` or a `lisp-and-java-name`.
- java-flag: `:public` | `:static` | `:synchronized`
- result-modifier: `:copy` | `:ref` | `:oneway` | `:ignore`
- java-return-type: java-arg-type | "void"
- java-arg-type: "int" | ... | class-name

This macro defines a Java method that calls the Lisp function. The Lisp function must be separately defined by the programmer.

When a method-name is specified as a list, the lisp-name should be a symbol and the java-name may be a symbol or a string. When method-name is specified as lisp-and-java-name, and lisp-and-java-name is a symbol, then the symbol-name string is used as the Java name. This is likely to be the correct Java name only in a Modern (case-sensitive) Allegro CL images (see case.htm).

When lisp-and-java-name is a string, the Lisp symbol is taken to be the result of read-from-string from a string of the form "ppp::sss" where `ppp` is the name of the current package and `sss` is the name string.

When a def-java-to-lisp-wrapper form is compiled (or evaluated) we write Java code definitions in the specified files. These definitions create Java classes where each method calls the corresponding Lisp function or method

In the Lisp environment, we create a Lisp class with def-java-class to represent the Java class.

The Lisp functions or methods must be separately defined by the programmer. See the file examples/jlinker/javabean/bean1.cl.

See jlinker.htm for more information on the jLinker facility.

Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version