MacroPackage: javatools.jlinkerToCDocOverviewCGDocRelNotesIndexPermutedIndex
Allegro CL version 6.1
Unrevised

def-java-constructor

Arguments: lisp-name (lisp-class &rest argtypes)

This macro defines a Lisp function that calls a Java constructor. The first argument is the name of the new Lisp function. The second argument is an argument list where the first item is the Lisp name of a class previously defined with def-java-class. The Lisp name is defined as a function of n arguments, where n is the number of argtypes specified. Each argtype is a string or symbol that denotes a Java class.

Examples

(def-java-class (string-buffer "java.lang.StringBuffer")
(application-buffer)
    ()
    ()
    ((source :initform "Java")))

(def-java-constructor new-string-buffer-int (string-buffer "int))

This form defines a Lisp function new-string-buffer-int that calls Java to create an instance of the Java class java.lang.StringBuffer, and returns a remote reference to the instance. The remote reference will be a Lisp instance of the class string-buffer.

The constructor is called as an ordinary Lisp function:

(new-string-buffer-int 17)

is an example of such a call.

(def-java-constructor new-string-buffer-str (string-buffer
"java.lang.String"))

This form defines another Lisp function (new-string-buffer-str that calls a different constructor of the java.lang.StringBuffer class. The Lisp function must have a different name because the constructors are ordinary functions, not generic functions, and thus cannot be overloaded in any way.

The constructor is also called as an ordinary Lisp function:

(new-string-buffer-str "abc")

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


Copyright (c) 1998-2001, Franz Inc. Berkeley, CA., USA. All rights reserved.
Documentation for Allegro CL version 6.1 update # 1. This page was not revised.
Created 2001.12.15.

ToCDocOverviewCGDocRelNotesIndexPermutedIndex
Allegro CL version 6.1
Unrevised