260612_01_ENH: length로 uuid 생성하는 유틸 추가

This commit is contained in:
2026-06-12 10:54:06 +09:00
parent 2439631e40
commit 2e194fb597
2 changed files with 13 additions and 1 deletions

View File

@@ -4,7 +4,7 @@ plugins {
}
// 버전 변경은 여기서
def commonVer = "beta.1.1.24"
def commonVer = "beta.1.1.25"
group = 'com.kri.common'
version = commonVer

View File

@@ -1,5 +1,6 @@
package com.kri.common.feature.util;
import com.kri.common.feature.web.BusinessException;
import java.util.UUID;
public final class CommonUtil {
@@ -10,4 +11,15 @@ public final class CommonUtil {
public static String uuid32() {
return UUID.randomUUID().toString().replace("-", "");
}
public static String uuid(int length) {
if (length <= 0) {
throw BusinessException.badRequest("length must be greater than 0");
}
if (length > 32) {
throw BusinessException.badRequest("length must be less than 32");
}
return UUID.randomUUID().toString().substring(0, length).replace("-", "");
}
}