Package com.github.f4b6a3.uuid.creator
Class AbstractUuidCreator
- java.lang.Object
-
- com.github.f4b6a3.uuid.creator.AbstractUuidCreator
-
- Direct Known Subclasses:
AbstractNameBasedUuidCreator,AbstractRandomBasedUuidCreator,AbstractTimeBasedUuidCreator
public abstract class AbstractUuidCreator extends Object
Abstract class forUUIDcreators.
-
-
Field Summary
Fields Modifier and Type Field Description protected intversionprotected longversionBits
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractUuidCreator()AbstractUuidCreator(int version)AbstractUuidCreator(UuidVersion version)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected UUIDgetUuid(byte[] bytes)Creates a UUID from a byte array of 16 bytes.protected UUIDgetUuid(long msb, long lsb)Creates a UUID from a pair of numbers.intgetVersion()Returns the version number for this creator.
-
-
-
Constructor Detail
-
AbstractUuidCreator
protected AbstractUuidCreator()
-
AbstractUuidCreator
public AbstractUuidCreator(int version)
-
AbstractUuidCreator
public AbstractUuidCreator(UuidVersion version)
-
-
Method Detail
-
getVersion
public int getVersion()
Returns the version number for this creator.- Returns:
- the version number
-
getUuid
protected UUID getUuid(byte[] bytes)
Creates a UUID from a byte array of 16 bytes. It applies the version number to the resulting UUID.- Parameters:
bytes- a byte array- Returns:
- a UUID
-
getUuid
protected UUID getUuid(long msb, long lsb)
Creates a UUID from a pair of numbers. It applies the version number to the resulting UUID.- Parameters:
msb- the most significant bitslsb- the least significant bits- Returns:
- a UUID
-
-