Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 29 lines (24 sloc) 0.79 kb
44962b2 @cemerick initial import from O'Reilly svn repo
cemerick authored
1 (ns com.clojurebook.CustomException
2 (:gen-class :extends RuntimeException
3 :implements [clojure.lang.IDeref]
4 :constructors {[java.util.Map String] [String]
5 [java.util.Map String Throwable] [String Throwable]}
6 :state info
7 :init init
8 :methods [[getInfo [] java.util.Map]
9 [addInfo [Object Object] void]]))
10
11 (import 'com.clojurebook.CustomException)
12
13 (defn- -init
14 ([info message]
15 [[message] (atom (into {} info))])
16 ([info message ex]
17 [[message ex] (atom (into {} info))]))
18
19 (defn- -deref
20 [^CustomException this]
21 @(.info this))
22
23 (defn- -getInfo
24 [this]
25 @this)
26
27 (defn- -addInfo
28 [^CustomException this key value]
29 (swap! (.info this) assoc key value))
Something went wrong with that request. Please try again.