JNanoId

A unique string ID generator for Java.

Лицензия

Лицензия

Категории

Категории

JNA Инструменты разработки Native
Группа

Группа

com.aventrix.jnanoid
Идентификатор

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

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

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

2.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

JNanoId
A unique string ID generator for Java.
Ссылка на сайт

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

https://github.com/aventrix/jnanoid
Организация-разработчик

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

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

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

https://github.com/aventrix/jnanoid

Скачать jnanoid

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.aventrix.jnanoid/jnanoid/ -->
<dependency>
    <groupId>com.aventrix.jnanoid</groupId>
    <artifactId>jnanoid</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.aventrix.jnanoid/jnanoid/
implementation 'com.aventrix.jnanoid:jnanoid:2.0.0'
// https://jarcasting.com/artifacts/com.aventrix.jnanoid/jnanoid/
implementation ("com.aventrix.jnanoid:jnanoid:2.0.0")
'com.aventrix.jnanoid:jnanoid:jar:2.0.0'
<dependency org="com.aventrix.jnanoid" name="jnanoid" rev="2.0.0">
  <artifact name="jnanoid" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.aventrix.jnanoid', module='jnanoid', version='2.0.0')
)
libraryDependencies += "com.aventrix.jnanoid" % "jnanoid" % "2.0.0"
[com.aventrix.jnanoid/jnanoid "2.0.0"]

Зависимости

test (2)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.11
org.hamcrest : hamcrest-junit jar 2.0.0.0

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

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

JNanoId

Build Status Maven Central

A unique string ID generator for Java.

Secure

JNanoID uses Java’s SecureRandom to generate cryptographically strong random IDs with a proper distribution of characters.

Compact

JNanoID generates compact IDs with just 21 characters. By using a larger alphabet than UUID, JNanoID can generate a greater number of unique IDs, when compared to UUID, with fewer characters (21 versus 36).

URL-Friendly

JNanoID uses URL-friendly characters (A-Za-z0-9_-). Perfect for unique identifiers in web applications.

Customizable

JNanoID is fully customizable. All default options may be overridden. Supply your own Random Number Generator, alphabet, or size.

Tested

JNanoID is thoroughly tested with JUnit.

Latest Release

The most recent release is JNanoId 2.0.0.

Maven

<dependency>
  <groupId>com.aventrix.jnanoid</groupId>
  <artifactId>jnanoid</artifactId>
  <version>2.0.0</version>
</dependency>

Gradle

compile 'com.aventrix.jnanoid:jnanoid:2.0.0'

Usage

JNanoId provides one easy-to-use utility class (NanoIdUtils) with two methods to generate IDs.

Standard IDs - randomNanoId()

The default method creates secure, url-friendly, unique ids. It uses a url-friendly alphabet (A-Za-z0-9_-), a secure random number generator, and generates a unique ID with 21 characters.

String id = NanoIdUtils.randomNanoId(); // "ku-qLNv1wDmIS5_EcT3j7"

Custom IDs - NanoIdUtils.randomNanoId(random, alphabet, size);

An additional method allows you to generate custom IDs by specifying your own random number generator, alphabet, or size.

// Use a faster, but non-secure, random generator
Random random = new Random();

// Use a custom alphabet containing only a, b, and c
char[] alphabet = {'a','b','c'};

// Make IDs 10 characters long
int size = 10;

String id = NanoIdUtils.randomNanoId(random, alphabet, 10); // "babbcaabcb"

Copyright and license

Code copyright 2017 The JNanoID Authors, Aventrix LLC, and Andrey Sitnik. Code released under the MIT License.

Based on the original NanoId for JavaScript by Andrey Sitnik.

Other Programming Languages

Also, a CLI tool is available to generate IDs from the command line.

com.aventrix.jnanoid

Aventrix

Aventrix helps people discover and share fun activities, events, and products.

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

Версия
2.0.0
1.0.1