Class UuidV4Generator
java.lang.Object
cloud.opencode.base.id.uuid.UuidV4Generator
- All Implemented Interfaces:
IdGenerator<UUID>
UUID v4 Generator
UUID v4生成器
Generates random UUIDs based on RFC 4122 version 4. Uses secure random number generator.
基于RFC 4122版本4生成随机UUID。使用安全随机数生成器。
Features | 主要功能:
- Cryptographically secure - 加密安全
- High entropy - 高熵值
- No central coordination required - 无需中心协调
Usage Examples | 使用示例:
UuidV4Generator gen = UuidV4Generator.create();
UUID uuid = gen.generate();
Performance | 性能特性:
- ~3M ops/sec single thread - 单线程约3M次/秒
- ~20M ops/sec with 8 threads - 8线程约20M次/秒
Security | 安全性:
- Thread-safe: Yes - 线程安全: 是
- Since:
- JDK 25, opencode-base-id V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic UuidV4Generatorcreate()Creates a UUID v4 generator 创建UUID v4生成器generate()Generates the next ID 生成下一个IDGenerates a simple UUID (no hyphens) 生成简化UUID(无连字符)Generates a UUID as string 生成UUID字符串getType()Gets the generator type name 获取生成器类型名称Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IdGenerator
generateBatch
-
Method Details
-
create
Creates a UUID v4 generator 创建UUID v4生成器- Returns:
- generator | 生成器
-
generate
Description copied from interface:IdGeneratorGenerates the next ID 生成下一个ID- Specified by:
generatein interfaceIdGenerator<UUID>- Returns:
- generated ID | 生成的ID
-
generateStr
-
generateSimple
Generates a simple UUID (no hyphens) 生成简化UUID(无连字符)- Returns:
- simple UUID string | 简化UUID字符串
-
getType
Description copied from interface:IdGeneratorGets the generator type name 获取生成器类型名称- Specified by:
getTypein interfaceIdGenerator<UUID>- Returns:
- type name | 类型名称
-