Package org.apache.jackrabbit.core.id
Class NodeId
- java.lang.Object
- 
- org.apache.jackrabbit.core.id.NodeId
 
- 
- All Implemented Interfaces:
- Serializable,- Comparable<NodeId>,- ItemId
 
 public class NodeId extends Object implements ItemId, Comparable<NodeId> Node identifier, i.e. an immutable 128 bit UUID.- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description static intUUID_BYTE_LENGTHNumber of bytes in a UUID (16).static intUUID_FORMATTED_LENGTHChars in a UUID String.
 - 
Constructor SummaryConstructors Constructor Description NodeId(byte[] bytes)Creates a node identifier from the given 16 bytes.NodeId(long msb, long lsb)Creates a node identifier from the given 128 bits.NodeId(String uuidString)Creates a node identifier from the given UUID string.NodeId(UUID uuid)Creates a node identifier from the given UUID.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(NodeId that)Compares this identifier to the given other one.booleandenotesNode()Returnstrueto indicate that this is a node identifier.booleanequals(Object that)Compares two UUID for equality.longgetLeastSignificantBits()Returns the 64 least significant bits of this identifier.longgetMostSignificantBits()Returns the 64 most significant bits of this identifier.byte[]getRawBytes()Returns the 16 bytes of this identifier.inthashCode()Returns a hash code of this identifier.static NodeIdrandomId()Creates a random node identifier using a secure random number generator.StringtoString()Returns the UUID string representation of this identifier.static NodeIdvalueOf(String uuid)Returns a node identifier that is represented by the given UUID string.
 
- 
- 
- 
Field Detail- 
UUID_FORMATTED_LENGTHpublic static final int UUID_FORMATTED_LENGTH Chars in a UUID String.- See Also:
- Constant Field Values
 
 - 
UUID_BYTE_LENGTHpublic static final int UUID_BYTE_LENGTH Number of bytes in a UUID (16).- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
NodeIdpublic NodeId(long msb, long lsb)Creates a node identifier from the given 128 bits.- Parameters:
- msb- most significant 64 bits
- lsb- least significant 64 bits
 
 - 
NodeIdpublic NodeId(byte[] bytes) throws NullPointerException, ArrayIndexOutOfBoundsExceptionCreates a node identifier from the given 16 bytes.- Parameters:
- bytes- array of 16 bytes
- Throws:
- NullPointerException- if the given array is- null
- ArrayIndexOutOfBoundsException- if the given array is less than 16 bytes long
 
 - 
NodeIdpublic NodeId(UUID uuid) Creates a node identifier from the given UUID.- Parameters:
- uuid- UUID
 
 - 
NodeIdpublic NodeId(String uuidString) throws IllegalArgumentException Creates a node identifier from the given UUID string.- Parameters:
- uuidString- UUID string
- Throws:
- IllegalArgumentException- if the UUID string is invalid
 
 
- 
 - 
Method Detail- 
valueOfpublic static NodeId valueOf(String uuid) throws IllegalArgumentException Returns a node identifier that is represented by the given UUID string.- Parameters:
- uuid- the UUID string
- Returns:
- the node identifier
- Throws:
- IllegalArgumentException- if the given string is- nullor not a valid UUID
 
 - 
randomIdpublic static NodeId randomId() Creates a random node identifier using a secure random number generator.
 - 
getMostSignificantBitspublic long getMostSignificantBits() Returns the 64 most significant bits of this identifier.- Returns:
- 64 most significant bits
 
 - 
getLeastSignificantBitspublic long getLeastSignificantBits() Returns the 64 least significant bits of this identifier.- Returns:
- 64 least significant bits
 
 - 
getRawBytespublic byte[] getRawBytes() Returns the 16 bytes of this identifier.- Returns:
- newly allocated array of 16 bytes
 
 - 
denotesNodepublic boolean denotesNode() Returnstrueto indicate that this is a node identifier.- Specified by:
- denotesNodein interface- ItemId
- Returns:
- always true
- See Also:
- PropertyId,- NodeId
 
 - 
compareTopublic int compareTo(NodeId that) Compares this identifier to the given other one.- Specified by:
- compareToin interface- Comparable<NodeId>
- Parameters:
- that- other identifier
- Returns:
- -1, 0 or +1 if this identifier is less than, equal to, or greater than the given other identifier
 
 - 
toStringpublic String toString() Returns the UUID string representation of this identifier.- Overrides:
- toStringin class- Object
- Returns:
- UUID string
- See Also:
- UUID.toString()
 
 - 
equalspublic boolean equals(Object that) Compares two UUID for equality.- Overrides:
- equalsin class- Object
- See Also:
- Object.equals(Object)
 
 
- 
 
-