public final class Keyword extends Object implements Named, Comparable<Keyword>, Serializable
Note: Keywords print with a leading colon, but this is not part of the keyword's name:
// For the keyword ":foo/bar"
Keyword k = newKeyword("foo", "bar");
k.getName() => "bar"
k.getPrefix() => "foo"
k.toString() => ":foo/bar"
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Keyword o) |
String |
getName()
The name of this named thing, not including any prefix.
|
String |
getPrefix()
The prefix, (also called namespace), which may be empty.
|
static Keyword |
newKeyword(String name)
This is equivalent to
newKeyword("", name). |
static Keyword |
newKeyword(String prefix,
String name)
Provide a Keyword with the given prefix and name.
|
static Keyword |
newKeyword(Symbol sym) |
String |
toString() |
public final String getPrefix()
public final String getName()
public static Keyword newKeyword(String prefix, String name)
Keywords are interned, which means that any two keywords which are equal (by value) will also be identical (by reference).
prefix - An empty String or a non-empty String obeying the restrictions
specified by edn. Never null.name - A non-empty string obeying the restrictions specified by edn.
Never null.public static Keyword newKeyword(String name)
newKeyword("", name).name - A non-empty string obeying the restrictions specified by edn.
Never null.newKeyword(String, String)public int compareTo(Keyword o)
compareTo in interface Comparable<Keyword>Copyright © 2019. All rights reserved.