Java UUID Generator

Java UUID Generator (JUG) is a Java library for generating Universally Unique IDentifiers, UUIDs (see http://en.wikipedia.org/wiki/UUID). It can be used either as a component in a bigger application, or as a standalone command line tool. JUG generates UUIDs according to the IETF UUID draft specification. JUG supports all 3 official UUID generation methods.

Лицензия

Лицензия

Категории

Категории

Java Языки программирования
Группа

Группа

com.fasterxml.uuid
Идентификатор

Идентификатор

java-uuid-generator
Последняя версия

Последняя версия

4.0.1
Дата

Дата

Тип

Тип

bundle
Описание

Описание

Java UUID Generator
Java UUID Generator (JUG) is a Java library for generating Universally Unique IDentifiers, UUIDs (see http://en.wikipedia.org/wiki/UUID). It can be used either as a component in a bigger application, or as a standalone command line tool. JUG generates UUIDs according to the IETF UUID draft specification. JUG supports all 3 official UUID generation methods.
Ссылка на сайт

Ссылка на сайт

https://github.com/cowtowncoder/java-uuid-generator
Организация-разработчик

Организация-разработчик

FasterXML.com
Система контроля версий

Система контроля версий

https://github.com/cowtowncoder/java-uuid-generator

Скачать java-uuid-generator

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.slf4j : slf4j-api jar 1.7.29

runtime (1)

Идентификатор библиотеки Тип Версия
org.slf4j : slf4j-simple Необязательный jar 1.7.29

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

Java Uuid Generator (JUG)

JUG is a set of Java classes for working with UUIDs: generating UUIDs using any of standard methods, outputting efficiently, sorting and so on. It generates UUIDs according to the UUID specification (RFC-4122) (also see Wikipedia UUID page for more explanation)

JUG was written by Tatu Saloranta (tatu.saloranta@iki.fi) originally in 2002 and has been updated over years. In addition, many other individuals have helped fix bugs and implement new features: please see release-notes/CREDITS for the complete list.

JUG is licensed under Apache License 2.0.

Status

Build Status Javadoc Tidelift

Usage

JUG can be used as a command-line tool (via class 'com.fasterxml.uuid.Jug`), or as a pluggable component.

Via Maven

Maven coordinates are:

<dependency>
  <groupId>com.fasterxml.uuid</groupId>
  <artifactId>java-uuid-generator</artifactId>
  <version>4.0</version>
</dependency>

Dependencies

The only dependency for JUG is the logging library:

  • For versions up to 3.x, log4j is used, optionally (runtime dependency)
  • For versions 4.x and up, slf4j API is used: logging implementation to be provided by calling application

JDK9+ module info

Since version 3.2.0, JUG defines JDK9+ compatible module-info.class, with module name of com.fasterxml.uuid.

Downloads

For direct downloads, check out Project Wiki.

Using JUG

Generation itself is done by first selecting a kind of generator to use, and then calling its generate() method, for example:

UUID uuid = Generators.randomBasedGenerator().generate();
UUID uuid = Generators.timeBasedGenerator().generate();

If you want customize generators, you may also just want to hold on to generator instance, for example:

TimeBasedGenerator gen = Generators.timeBasedGenerator(EthernetAddress.fromInterface());
UUID uuid = gen.generate();
UUID anotherUuid = gen.generate();

Generators are fully thread-safe, so a single instance may be shared among multiple threads.

JavaDocs for project can be found from Project Wiki.

Compatibility

JUG versions 3.1 and later require JDK 1.6 to work, mostly to be able to access local Ethernet MAC address. Earlier versions (3.0 and before) worked on 1.4 (which introduced java.util.UUID).

Known Issues

JDK's java.util.UUID has flawed implementation of compareTo(), which uses naive comparison of 64-bit values. This does NOT work as expected, given that underlying content is for all purposes unsigned. For example two UUIDs:

7f905a0b-bb6e-11e3-9e8f-000000000000
8028f08c-bb6e-11e3-9e8f-000000000000

would be ordered with second one first, due to sign extension (second value is considered to be negative, and hence "smaller").

Because of this, you should always use external comparator, such as com.fasterxml.uuid.UUIDComparator, which implements expected sorting order that is simple unsigned sorting, which is also same as lexicographic (alphabetic) sorting of UUIDs (when assuming uniform capitalization).

Enterprise support

Available as part of the Tidelift Subscription.

The maintainers of java-uuid-generator and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

Contributing

For simple bug reports and fixes, and feature requests, please simply use projects Issue Tracker, with exception of security-related issues for which we recommend filing Tidelift security contact (NOTE: you do NOT have to be a subscriber to do this).

Alternative JVM UUID generators

There are many other publicly available UUID generators. For example:

Note that although some packages claim to be faster than others, it is not clear whether:

  1. Claims have been properly verified (or, if they have, can be independently verified), AND
  2. It is not likely that performance differences truly matter: JUG, for example, can generate a millions of UUID per second per core (sometimes hitting the theoretical limit of 10 million per second) -- and it seems unlikely that generation will be bottleneck for about any use case

so it is often best to choose based on stability of packages and API.

Версии библиотеки

Версия
4.0.1
4.0
3.3.0
3.2.0
3.1.5
3.1.4
3.1.3
3.1.2
3.1.1
3.1.0
3.0.0