cn.vonce.sql.uitls.IdBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vonce-sqlbean-core Show documentation
Show all versions of vonce-sqlbean-core Show documentation
This is the core project of Sqlbean.
The newest version!
package cn.vonce.sql.uitls;
import java.util.UUID;
/**
* Id创建者
*
* @author Jovi
* @email [email protected]
* @date 2022/6/21 11:41
*/
public class IdBuilder {
/**
* 生成uuid
*
* @return
*/
public static String uuid() {
return UUID.randomUUID().toString().replace("-", "");
}
/**
* 生成ulid
*
* @return
*/
public static String ulid() {
return UlidCreator.getUlid().toString();
}
/**
* 生成16位雪花id
*
* @return
*/
public static long snowflake16() {
return SnowflakeId16.nextId();
}
/**
* 生成18位雪花id
*
* @return
*/
public static long snowflake18() {
return SnowflakeId18.instance().nextId();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy