Can I get in LISP all the method names from a class?
Actually I need the methods, which have
set-
in their names.
Can I get in LISP all the method names from a class?
Actually I need the methods, which have
set-
in their names.
For LispWorks:
(defun find-all-methods (class prefix)
(loop for method in (clos:specializer-direct-methods class)
for gf = (method-generic-function method)
for fname = (generic-function-name gf)
for fname-string = (when (symbolp fname) (symbol-name fname))
when (and (stringp fname-string)
(>= (length fname-string)
(length prefix))
(string= fname-string prefix
:end1 (length prefix)
:end2 (length prefix)))
collect method))
Example:
CL-USER 20 > (pprint (find-all-methods (find-class 'capi:button) "PRINT-"))
(#<STANDARD-METHOD CAPI:PRINT-COLLECTION-ITEM NIL (CAPI:BUTTON T) 40E06173D3>
#<STANDARD-METHOD CAPI:PRINT-CAPI-BUTTON NIL (CAPI:BUTTON) 40E05F9DDB>)
(ql:quickload 'closer-mop) and adjusting the missing functions to the ones from the closer-mop package.