| 34 | |
| 35 | == Dissecting a Java class definition == |
| 36 | |
| 37 | In the context of runtime-class, a class definition is a series of arguments that can (or must) be passed to either ```define-java-class``` or ```jnew-runtime-class```. They are detailed below. |
| 38 | |
| 39 | * '''```class-name```''' - mandatory argument. A string that must be a valid Java class name according to the Java Language Specification, specifying the name of the defined class. |
| 40 | * '''```superclass```''' - keyword argument; defaults to "java.lang.Object". A string that must be a valid Java class name according to the Java Language Specification, specifying the superclass of the class being defined. |
| 41 | * '''```interfaces```''' - keyword argument. A (possibly empty) list of strings naming Java interfaces to be implemented by the defined class. |
| 42 | * '''```methods```''' - keyword argument. A (possibly empty) list of method definitions (see the appropriate section below). |
| 43 | * '''```fields```''' - keyword argument. A (possibly empty) list of field definitions (see the appropriate section below). |
| 44 | * '''```access-flags```''' - keyword argument; defaults to '''(:public)'''. A (possibly empty) list of access flags as accepted by the Java class file writer, which will be applied to the defined class. |
| 45 | * '''```annotations```''' - keyword argument. A (possibly empty) list of annotation definitions (see the appropriate section below) to be applied to the defined class. |
| 46 | |
| 47 | === Method definitions === |
| 48 | |
| 49 | Arguably, the most important feature of runtime-class is to define Java methods in Lisp. Each method is implemented as a call to a pre-existing Lisp function, with the necessary conversions for arguments and return values. Contrarily to the old implementation of runtime-class, no API is specified to replace method implementations at runtime; instead, you can leverage the usual mechanism of passing a symbol as a function designator and later replacing its symbol-function. |