/
atom.clj
44 lines (38 loc) · 1.18 KB
/
atom.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
(ns jiface.erlang.atom
(:require
[potemkin :refer [import-vars]]
[jiface.erlang.object :as object])
(:import
(com.ericsson.otp.erlang OtpErlangAtom
OtpErlangBoolean))
(:refer-clojure :exclude [hash]))
(defprotocol ErlangAtom
(get-atom-value [this]
"Get the actual string contained in this object.")
(get-boolean-value [this]
"The boolean value of this atom.")
;; XXX not working right now - it can't find the static field
;;(get-max-length [this] "The maximun allowed length of an atom, in characters.")
)
(def behaviour
{:get-atom-value (fn [this] (.atomValue this))
;; The maxAtomLength static field isn't getting found ... not sure what's up widdat
;;:get-max-length (fn [this]
;; (.-maxAtomLength this))
:get-boolean-value (fn [this] (.booleanValue this))})
(extend OtpErlangAtom object/ErlangObject object/behaviour)
(extend OtpErlangAtom ErlangAtom behaviour)
(extend OtpErlangBoolean object/ErlangObject object/behaviour)
(extend OtpErlangBoolean ErlangAtom behaviour)
;;; Aliases
(import-vars
[object
;; object-behaviour
bind
clone
decode
encode
equal?
hash
match
->str])