Package discord4j.discordjson
Class Id
- java.lang.Object
-
- discord4j.discordjson.Id
-
public class Id extends Object
Represents an unsigned 64-bit ID. This object is serialized through String despite using long field for storage and is used when building immutable objects for an alternative compact structure, reducing required memory.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longasLong()Gets the unsigned ID as a primitive long.StringasString()Gets the unsigned ID as an object String.booleanequals(Object o)inthashCode()static Idof(long value)Constructs anIDutilizing an unsigned ID.static Idof(String value)Constructs anIDutilizing an unsigned ID.StringtoString()
-
-
-
Method Detail
-
of
public static Id of(long value)
Constructs anIDutilizing an unsigned ID.- Parameters:
value- The unsigned ID to construct aID.- Returns:
- A constructed
IDwith the unsigned ID.
-
of
public static Id of(String value)
Constructs anIDutilizing an unsigned ID.- Parameters:
value- The unsigned ID to construct aID. Must be non-null.- Returns:
- A constructed
IDwith the unsigned ID. - Throws:
NumberFormatException- Ifidis not an unsigned ID.
-
asString
public String asString()
Gets the unsigned ID as an object String.- Returns:
- The unsigned ID as String.
-
asLong
public long asLong()
Gets the unsigned ID as a primitive long.- Returns:
- The unsigned ID as long.
-
-