public enum TimeUUIDGenerator extends Enum<TimeUUIDGenerator>
UUIDGen class and by the DataStax Java
driver's UUIDs class.| Enum Constant and Description |
|---|
FIXED
Generates version 1 UUIDs using a fixed local clock sequence and node ID.
|
MAX
Generates the biggest possible type 1 UUID having the provided
Instant. |
MIN
Generates the smallest possible type 1 UUID having the provided
Instant. |
RANDOM
Generates version 1 UUIDs using a random number in lieu of the local clock sequence and node
ID.
|
| Modifier and Type | Field and Description |
|---|---|
static long |
EPOCH_OFFSET
The timestamp is a 60-bit value.
|
| Modifier and Type | Method and Description |
|---|---|
static Instant |
fromUUIDTimestamp(long timestamp) |
abstract UUID |
generate(Instant instant)
|
static long |
toUUIDTimestamp(Instant instant) |
static TimeUUIDGenerator |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static TimeUUIDGenerator[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final TimeUUIDGenerator FIXED
Note that this strategy is generally only safe to use if you can guarantee that the provided timestamps are unique across calls (otherwise the generated UUIDs won't be unique across calls).
public static final TimeUUIDGenerator RANDOM
If you can guarantee that the instant argument is unique (for this JVM instance) for
every call, then you should prefer FIXED, MIN or MAX which are
faster. If you can't guarantee this however, this strategy will ensure the generated UUIDs are
still unique (across calls) through randomization.
public static final TimeUUIDGenerator MIN
Instant.
Note that this strategy is generally only safe to use if you can guarantee that the provided timestamps are unique across calls (otherwise the generated UUIDs won't be unique across calls).
public static final TimeUUIDGenerator MAX
Instant.
Note that this strategy is generally only safe to use if you can guarantee that the provided timestamps are unique across calls (otherwise the generated UUIDs won't be unique across calls).
public static final long EPOCH_OFFSET
public static TimeUUIDGenerator[] values()
for (TimeUUIDGenerator c : TimeUUIDGenerator.values()) System.out.println(c);
public static TimeUUIDGenerator valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic abstract UUID generate(Instant instant)
instant - the instant to use.UUID.public static long toUUIDTimestamp(Instant instant)
public static Instant fromUUIDTimestamp(long timestamp)
Copyright © 2017–2021 DataStax. All rights reserved.