提交 | 用户 | 时间
|
e57a89
|
1 |
package com.jcdm.common.utils.uuid; |
懒 |
2 |
|
|
3 |
/** |
|
4 |
* ID生成器工具类 |
|
5 |
* |
|
6 |
* @author jc |
|
7 |
*/ |
|
8 |
public class IdUtils |
|
9 |
{ |
|
10 |
/** |
|
11 |
* 获取随机UUID |
|
12 |
* |
|
13 |
* @return 随机UUID |
|
14 |
*/ |
|
15 |
public static String randomUUID() |
|
16 |
{ |
|
17 |
return UUID.randomUUID().toString(); |
|
18 |
} |
|
19 |
|
|
20 |
/** |
|
21 |
* 简化的UUID,去掉了横线 |
|
22 |
* |
|
23 |
* @return 简化的UUID,去掉了横线 |
|
24 |
*/ |
|
25 |
public static String simpleUUID() |
|
26 |
{ |
|
27 |
return UUID.randomUUID().toString(true); |
|
28 |
} |
|
29 |
|
|
30 |
/** |
|
31 |
* 获取随机UUID,使用性能更好的ThreadLocalRandom生成UUID |
|
32 |
* |
|
33 |
* @return 随机UUID |
|
34 |
*/ |
|
35 |
public static String fastUUID() |
|
36 |
{ |
|
37 |
return UUID.fastUUID().toString(); |
|
38 |
} |
|
39 |
|
|
40 |
/** |
|
41 |
* 简化的UUID,去掉了横线,使用性能更好的ThreadLocalRandom生成UUID |
|
42 |
* |
|
43 |
* @return 简化的UUID,去掉了横线 |
|
44 |
*/ |
|
45 |
public static String fastSimpleUUID() |
|
46 |
{ |
|
47 |
return UUID.fastUUID().toString(true); |
|
48 |
} |
|
49 |
} |