chickadee » javahack » java

(java SYMBOL)syntax

Returns the value represented by SYMBOL which should designate a Java class, field, or method, using `Java Dot' notation:

SyntaxType of MemberExample
"." at the endconstructor((java Font.) NAME STYLE SIZE)
"." at the beginninginstance member((java .setFont) COMP FONT)
"." at beginning and "$" at the endinstance field(define (mycar x) ((java .first$) x)) (define (myset-car! x y) ((java .first$) x y))
"." only in the middlestatic member((java Math.round) 123.456)
".class" suffixJava class(java Font.class)
"$" at the endstatic field(java Font.BOLD$) (set! (java "U.useJavaSyntax$") #t)
"$" in the middleinner class(java java.awt.geom.Point2D$Double.class)
"$" at the beginningpackageless class(java $ParseDemo.class)
"#" at the endallow private access((java .name$#) ((java Symbol.#) "abc"))

Notes:

* Each evaluation of the java macro sends an expression to the java process and receives a result expression. Since most of the results will stay constant throughout the lifetime of the session (as they refer to classes, fields and methods), they are cached and subsequent evaluation of the same (java ...) expression will refer to the cached value instead. You can disable this caching (in case you are doing rather funky things) with the help of the java-enable-cache form (see below).

* Java objects which are returned from the Java-side can be safely used and are only garbage collected when no more references exist.