1 package org
.argeo
.api
.uuid
;
6 * An {@link UuidFactory} which does not implement any algorith and returns
7 * {@link UnsupportedOperationException} for methods requiring them. Only
8 * {@link UuidFactory#get()} and {@link UuidFactory#randomUUID()} are
9 * implemented, trivially based on {@link UUID#randomUUID()}. It can be useful
10 * as a base class for partial implementations, or whren only random
11 * {@link UUID}s are needed, but one wants to integrate with this UUID API via
12 * {@link UuidFactory}.
14 public class NoOpUuidFactory
implements UuidFactory
{
15 public static final UuidFactory onlyJavaRandom
= new NoOpUuidFactory();
17 /** Returns {@link #randomUUID()}. */
24 * Creates a random UUID (v4) with {@link UUID#randomUUID()}.
26 * @return a random {@link UUID}
29 public UUID
randomUUID() {
30 return UUID
.randomUUID();
34 * Throws an {@link UnsupportedOperationException}.
36 * @throws UnsupportedOperationException always
39 public UUID
timeUUID() {
40 throw new UnsupportedOperationException("Time based UUIDs are not implemented");
44 * Throws an {@link UnsupportedOperationException}.
46 * @throws UnsupportedOperationException always
49 public UUID
nameUUIDv5(UUID namespace
, byte[] data
) {
50 throw new UnsupportedOperationException("Name based UUIDs are not implemented");
54 * Throws an {@link UnsupportedOperationException}.
56 * @throws UnsupportedOperationException always
59 public UUID
nameUUIDv3(UUID namespace
, byte[] data
) {
60 throw new UnsupportedOperationException("Name based UUIDs are not implemented");
64 * Throws an {@link UnsupportedOperationException}.
66 * @throws UnsupportedOperationException always
69 public UUID
randomUUIDStrong() {
70 throw new UnsupportedOperationException("Strong random UUIDs are not implemented");
74 * Throws an {@link UnsupportedOperationException}.
76 * @throws UnsupportedOperationException always
79 public UUID
randomUUIDWeak() {
80 throw new UnsupportedOperationException("Weak random UUIDs are not implemented");