MCPcopy Index your code
hub / github.com/clojure/clojure / Symbol

Class Symbol

src/jvm/clojure/lang/Symbol.java:19–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17
18
19public class Symbol extends AFn implements IObj, Comparable, Named, Serializable, IHashEq{
20
21private static final long serialVersionUID = 1191039485148212259L;
22
23final String ns;
24final String name;
25private int _hasheq;
26final IPersistentMap _meta;
27transient String _str;
28
29public String toString(){
30 if(_str == null){
31 if(ns != null)
32 _str = (ns + "/" + name);
33 else
34 _str = name;
35 }
36 return _str;
37}
38
39public String getNamespace(){
40 return ns;
41}
42
43public String getName(){
44 return name;
45}
46
47// the create thunks preserve binary compatibility with code compiled
48// against earlier version of Clojure and can be removed (at some point).
49static public Symbol create(String ns, String name) {
50 return Symbol.intern(ns, name);
51}
52
53static public Symbol create(String nsname) {
54 return Symbol.intern(nsname);
55}
56
57static public Symbol intern(String ns, String name){
58 return new Symbol(ns, name);
59}
60
61static public Symbol intern(String nsname){
62 int i = nsname.indexOf('/');
63 if(i == -1 || nsname.equals("/"))
64 return new Symbol(null, nsname);
65 else
66 return new Symbol(nsname.substring(0, i), nsname.substring(i + 1));
67}
68
69private Symbol(String ns_interned, String name_interned){
70 this.name = name_interned;
71 this.ns = ns_interned;
72 this._meta = null;
73}
74
75public boolean equals(Object o){
76 if(this == o)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected