Advertisement
Guest User

Untitled

a guest
May 29th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. (ns my.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. :init init
  7. :state info
  8. :methods [[getInfo [] java.util.Map]
  9. [addInfo [Object Object] void]]))
  10.  
  11. (import 'my.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))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement