Changeset 12774 for trunk/abcl/src/org/armedbear/lisp/java.lisp
- Timestamp:
- 07/01/10 21:02:45 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/java.lisp
r12715 r12774 93 93 94 94 (defgeneric jmake-proxy (interface implementation &optional lisp-this) 95 (:documentation "Returns a proxy Java object implementing the provided interface using methods implemented in Lisp - typically closures, but implementations are free to provide other mechanisms. You can pass an optional 'lisp-this' object that will be passed to the implementing methods as their first argument. If you don't provide this object, NIL will be used. The second argument of the Lisp methods is the name of the Java method being implemented. This has the implication that overloaded methods are merged, so you have to manually discriminate them if you want to. The remaining arguments are java-objects wrapping the method's parameters.")) 95 (:documentation "Returns a proxy Java object implementing the provided interface(s) using methods implemented in Lisp - typically closures, but implementations are free to provide other mechanisms. You can pass an optional 'lisp-this' object that will be passed to the implementing methods as their first argument. If you don't provide this object, NIL will be used. The second argument of the Lisp methods is the name of the Java method being implemented. This has the implication that overloaded methods are merged, so you have to manually discriminate them if you want to. The remaining arguments are java-objects wrapping the method's parameters.")) 96 97 (defun canonicalize-jproxy-interfaces (ifaces) 98 (if (listp ifaces) 99 (mapcar #'jclass ifaces) 100 (list (jclass ifaces)))) 101 96 102 97 103 (defmethod jmake-proxy (interface invocation-handler &optional lisp-this) 98 104 "Basic implementation that directly uses an invocation handler." 99 (%jmake-proxy ( jclass interface) invocation-handler lisp-this))105 (%jmake-proxy (canonicalize-jproxy-interfaces interface) invocation-handler lisp-this)) 100 106 101 107 (defmethod jmake-proxy (interface (implementation function) &optional lisp-this) 102 108 "Implements a Java interface forwarding method calls to a Lisp function." 103 (%jmake-proxy ( jclass interface) (jmake-invocation-handler implementation) lisp-this))109 (%jmake-proxy (canonicalize-jproxy-interfaces interface) (jmake-invocation-handler implementation) lisp-this)) 104 110 105 111 (defmethod jmake-proxy (interface (implementation package) &optional lisp-this) … … 115 121 (princ (char-upcase char) str))) 116 122 name))))) 117 (%jmake-proxy ( jclass interface)123 (%jmake-proxy (canonicalize-jproxy-interfaces interface) 118 124 (jmake-invocation-handler 119 125 (lambda (obj method &rest args) … … 134 140 (defmethod jmake-proxy (interface (implementation hash-table) &optional lisp-this) 135 141 "Implements a Java interface using closures in an hash-table keyed by Java method name." 136 (%jmake-proxy ( jclass interface)142 (%jmake-proxy (canonicalize-jproxy-interfaces interface) 137 143 (jmake-invocation-handler 138 144 (lambda (obj method &rest args)
Note: See TracChangeset
for help on using the changeset viewer.