@Immutable
public final class ReferenceToken
extends java.lang.Object
This class represents one reference token. It has no publicly available constructor; instead, it has static factory methods used to generate tokens depending on whether the input is a decoded (raw) token or an encoded (cooked) one, or even an integer.
The only characters to encode in a raw token are /
(which becomes
~1
) and ~
(which becomes ~0
).
Note that a reference token may be empty (empty object member names are legal!).
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
static ReferenceToken |
fromCooked(java.lang.String cooked)
Generate a reference token from an encoded (cooked) representation
|
static ReferenceToken |
fromInt(int index)
Generate a reference token from an integer
|
static ReferenceToken |
fromRaw(java.lang.String raw)
Generate a reference token from a decoded (raw) representation
|
java.lang.String |
getRaw()
Get the raw representation of that token as a string
|
int |
hashCode() |
java.lang.String |
toString() |
public static ReferenceToken fromCooked(java.lang.String cooked) throws JsonPointerException
cooked
- the inputJsonPointerException
- illegal token (bad encode sequence)java.lang.NullPointerException
- null inputpublic static ReferenceToken fromRaw(java.lang.String raw)
raw
- the inputjava.lang.NullPointerException
- null inputpublic static ReferenceToken fromInt(int index)
index
- the integerpublic java.lang.String getRaw()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object