Changeset 13372


Ignore:
Timestamp:
07/04/11 09:02:18 (10 years ago)
Author:
Mark Evenson
Message:

Document the extension to CLOS specialization for Java objects.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/doc/manual/abcl.tex

    r13338 r13372  
    369369\include{extensions}
    370370
     371\subsection{Beyond ANSI}
     372
     373Naturally, in striving to be a useful contemporary Common Lisp
     374implementation, ABCL endeavors to include extensions beyond the ANSI
     375specification which are either widely adopted or are especially useful
     376in working with the hosting JVM.
     377
     378\subsubsection{Extensions to CLOS}
     379
     380There is an additional syntax for specializing the parameter of a
     381generic function on a java class, viz. (java:jclass CLASS__STRING)
     382where CLASS__STRING is a string naming a Java class in dotted package
     383form.
     384
     385For instance the following specialization would perhaps allow one to
     386print more information about the contents of a java.util.Collection
     387object
     388
     389\begin[java]{code}
     390(defmethod print-object ((coll (java:jclass "java.util.Collection")) stream)
     391 â€Š
     392 \end[java]{code}
     393
     394If the class had been loaded via a classloader other than the original
     395the class you wish to specialize on, one needs to specify the
     396classloader as an optional third argument.
     397
     398\begin[java]{code}
     399(defmethod print-object ((device-id (java:jclass "dto.nbi.service.hdm.alcatel.com.NBIDeviceID"
     400                                    (#"getBaseLoader" cl-user::*classpath-manager*)))
     401 â€Š
     402 \end[java]{code}
     403
     404
    371405\section{Multithreading}
    372406
Note: See TracChangeset for help on using the changeset viewer.