club.gclmit.chaos.enums.IDGenerator Maven / Gradle / Ivy
package club.gclmit.chaos.enums;
import club.gclmit.chaos.executor.SnowflakeIdGenerator;
/**
*
* TODO
*
*
* @author: gclm
* @date: 2019-10-22 20:53:00
* @version: V1.0
* @since JDK1.8
*/
public enum IDGenerator {
/**
* 基础公共
*/
BASIC(0),
/**
* 业务服务
*/
BUSSINESS(1),
/**
* 其它
*/
OTHER(255);
private SnowflakeIdGenerator snowflakeIdGenerator;
IDGenerator(final int service) {
snowflakeIdGenerator = new SnowflakeIdGenerator(service);
}
public long getIdGen() {
return snowflakeIdGenerator.nextId();
}
public String getIdGenStr() {
return String.valueOf(snowflakeIdGenerator.nextId());
}
}