source: branches/streams/abcl/examples/java-interface/bank-account.lisp

Last change on this file was 13186, checked in by Mark Evenson, 14 years ago

Add a slightly simpler example of implemeting a Java interface in Lisp.

TODO Needs further documentation.

File size: 509 bytes
Line 
1(defparameter *bank-account-impl*
2  (let ((balance 1000))
3    (jinterface-implementation
4     "BankAccount"
5
6     "getBalance" 
7       (lambda ()
8         balance)
9     "deposit" 
10        (lambda (amount) 
11          (let ((amount (jobject-lisp-value amount)))
12            (setf balance (+ balance amount))))
13     "withdraw" 
14       (lambda (amount)
15         (let ((amount (jobject-lisp-value amount)))
16           (setf balance (- balance amount)))))))
17
18(defun get-bank-account-impl () 
19  *bank-account-impl*)
Note: See TracBrowser for help on using the repository browser.