public abstract class UuidFactory extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
UuidFactory.Parameters
Parameters object to be used with a
create(Parameters). |
| Modifier and Type | Field and Description |
|---|---|
protected UuidVersion |
version
Version number.
|
protected long |
versionMask
Version bit mask.
|
| Constructor and Description |
|---|
UuidFactory()
Default Constructor.
|
UuidFactory(UuidVersion version)
Constructor with a version number.
|
| Modifier and Type | Method and Description |
|---|---|
abstract UUID |
create()
Create a UUID
|
abstract UUID |
create(UuidFactory.Parameters parameters)
Creates a UUID using parameters.
|
UuidVersion |
getVersion()
Returns the version number for this factory.
|
protected static byte[] |
nameBytes(byte[] name)
Returns a copy of the input byte array.
|
protected static byte[] |
nameBytes(String name)
Converts a name string into a byte array.
|
protected static byte[] |
namespaceBytes(String namespace)
Converts a name space string into a byte array.
|
protected static byte[] |
namespaceBytes(UUID namespace)
Converts a name space UUID into a byte array.
|
protected static byte[] |
namespaceBytes(UuidNamespace namespace)
Converts a name space enumeration into a byte array.
|
protected UUID |
toUuid(long msb,
long lsb)
Creates a UUID from a pair of numbers.
|
protected final UuidVersion version
protected final long versionMask
public UuidFactory()
The version used is UuidVersion.VERSION_UNKNOWN.
public UuidFactory(UuidVersion version)
version - a version numberpublic UuidVersion getVersion()
public abstract UUID create()
public abstract UUID create(UuidFactory.Parameters parameters)
parameters - parameters objectprotected static byte[] nameBytes(byte[] name)
name - a name stringIllegalArgumentException - if the input is nullprotected static byte[] nameBytes(String name)
name - a name stringIllegalArgumentException - if the input is nullprotected static byte[] namespaceBytes(UuidNamespace namespace)
namespace - a name space enumerationprotected static byte[] namespaceBytes(UUID namespace)
namespace - a name space UUIDprotected static byte[] namespaceBytes(String namespace)
namespace - a name space stringInvalidUuidException - if the name space is invalidprotected UUID toUuid(long msb, long lsb)
It applies the version and variant numbers to the resulting UUID.
msb - the most significant bitslsb - the least significant bitsCopyright © 2024. All rights reserved.