us.bpsm.edn
Class Keyword
- java.lang.Object
-
- us.bpsm.edn.Keyword
-
public final class Keyword extends java.lang.Object implements Named, java.lang.Comparable<Keyword>
A Keyword is Named. Additionally it obeys the syntactic restrictions defined for edn Keywords.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"
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description intcompareTo(Keyword o)java.lang.StringgetName()The name of this named thing, not including any prefix.java.lang.StringgetPrefix()The prefix, (also called namespace), which may be empty.static KeywordnewKeyword(java.lang.String name)This is equivalent tonewKeyword("", name).static KeywordnewKeyword(java.lang.String prefix, java.lang.String name)Provide a Keyword with the given prefix and name.static KeywordnewKeyword(Symbol sym)java.lang.StringtoString()
-
-
-
Method Detail
-
getPrefix
public final java.lang.String getPrefix()
The prefix, (also called namespace), which may be empty. A Named object with an empty prefix is said to have no prefix.
-
getName
public final java.lang.String getName()
The name of this named thing, not including any prefix.
-
newKeyword
public static Keyword newKeyword(java.lang.String prefix, java.lang.String name)
Provide a Keyword with the given prefix and name.Keywords are interned, which means that any two keywords which are equal (by value) will also be identical (by reference).
- Parameters:
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.- Returns:
- a Keyword, never null.
-
newKeyword
public static Keyword newKeyword(java.lang.String name)
This is equivalent tonewKeyword("", name).- Parameters:
name- A non-empty string obeying the restrictions specified by edn. Never null.- Returns:
- a Keyword without a prefix, never null.
- See Also:
newKeyword(String, String)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG