Package org.apache.flink.util
Class AbstractID
- java.lang.Object
-
- org.apache.flink.util.AbstractID
-
- All Implemented Interfaces:
Serializable,Comparable<AbstractID>
- Direct Known Subclasses:
JobID
@PublicEvolving public class AbstractID extends Object implements Comparable<AbstractID>, Serializable
A statistically unique identification number.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractID()Constructs a new random ID from a uniform distribution.AbstractID(byte[] bytes)Constructs a new ID with a specific bytes value.AbstractID(long lowerPart, long upperPart)Constructs a new abstract ID.AbstractID(AbstractID id)Copy constructor: Creates a new abstract ID from the given one.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(AbstractID o)booleanequals(Object obj)byte[]getBytes()Gets the bytes underlying this ID.longgetLowerPart()Gets the lower 64 bits of the ID.longgetUpperPart()Gets the upper 64 bits of the ID.inthashCode()StringtoHexString()Returns pure String representation of the ID in hexadecimal.StringtoString()
-
-
-
Field Detail
-
SIZE
public static final int SIZE
The size of the ID in byte.- See Also:
- Constant Field Values
-
upperPart
protected final long upperPart
The upper part of the actual ID.
-
lowerPart
protected final long lowerPart
The lower part of the actual ID.
-
-
Constructor Detail
-
AbstractID
public AbstractID(byte[] bytes)
Constructs a new ID with a specific bytes value.
-
AbstractID
public AbstractID(long lowerPart, long upperPart)Constructs a new abstract ID.- Parameters:
lowerPart- the lower bytes of the IDupperPart- the higher bytes of the ID
-
AbstractID
public AbstractID(AbstractID id)
Copy constructor: Creates a new abstract ID from the given one.- Parameters:
id- the abstract ID to copy
-
AbstractID
public AbstractID()
Constructs a new random ID from a uniform distribution.
-
-
Method Detail
-
getLowerPart
public long getLowerPart()
Gets the lower 64 bits of the ID.- Returns:
- The lower 64 bits of the ID.
-
getUpperPart
public long getUpperPart()
Gets the upper 64 bits of the ID.- Returns:
- The upper 64 bits of the ID.
-
getBytes
public byte[] getBytes()
Gets the bytes underlying this ID.- Returns:
- The bytes underlying this ID.
-
toHexString
public final String toHexString()
Returns pure String representation of the ID in hexadecimal. This method should be used to construct things like paths etc., that require a stable representation and is therefore final.
-
compareTo
public int compareTo(AbstractID o)
- Specified by:
compareToin interfaceComparable<AbstractID>
-
-