hi,

you could use a simple class signature generator and then run javadoc
on it:

(def javadoc-strings (atom {}))

(defn javadoc [class name & body]
  (swap! javadoc-strings update-in [class] #(conj (or % []) %2) [name
(apply str body)])
  nil)

(defn -myMethod
  "My cool documentation"
  [x y]
  '...)

(javadoc 'MyClass '-myMethod
         "
/* .....
 * " (:doc (meta #'-myMethod)) "
 */
 public Object MyMethod(int x, int y) { };
")

(javadoc 'Bar 'one "
/*
 *
 */
 public Object one(int t) {};
")

(javadoc 'Bar 'two "
/*
 *
 */
 public Object one(int t) {};
")

(deftype Bar [x]
  Foo
  (one [t] (+ x 2))
  (two [t] (+ x 2)))

(defn make-docclass [p c]
  (let [cname (str c)
        methods (into {} (get @javadoc-strings c))]
    (str "package " p \; \newline
         "public class " c "{" \newline
         (apply str (interpose \newline (map second methods)))
         "}")))

(clojure.contrib.io/make-parents (java.io.File. "<dir>/src/bar/foo/
Bar.java"))
(clojure.contrib.io/spit
 "<dir>/src/bar/foo/Bar.java"
 (make-docclass "bar.foo" 'Bar))

;; in the <dir> directory, call:
;; javadoc -sourcepath src bar.foo


Depending on your time and macro-foo skills, you can extend this to
automtically generate documentation from a genclass definition or a
whole namespace. But for  a one-shot documentation of a simple API,
this might be enough.

Erik

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to