@Immutable public final class ReferenceToken extends 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(Object obj) |
static ReferenceToken |
fromCooked(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(String raw)
Generate a reference token from a decoded (raw) representation
|
String |
getRaw()
Get the raw representation of that token as a string
|
int |
hashCode() |
String |
toString() |
public static ReferenceToken fromCooked(String cooked) throws JsonPointerException
cooked
- the inputJsonPointerException
- illegal token (bad encode sequence)NullPointerException
- null inputpublic static ReferenceToken fromRaw(String raw)
raw
- the inputNullPointerException
- null inputpublic static ReferenceToken fromInt(int index)
index
- the integerpublic String getRaw()