From 2e194fb59728ff82e961578ab46c379f21cc7386 Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Fri, 12 Jun 2026 10:54:06 +0900 Subject: [PATCH] =?UTF-8?q?260612=5F01=5FENH:=20length=EB=A1=9C=20uuid=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=ED=95=98=EB=8A=94=20=EC=9C=A0=ED=8B=B8=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- .../java/com/kri/common/feature/util/CommonUtil.java | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a90b702..b4a625a 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } // 버전 변경은 여기서 -def commonVer = "beta.1.1.24" +def commonVer = "beta.1.1.25" group = 'com.kri.common' version = commonVer diff --git a/src/main/java/com/kri/common/feature/util/CommonUtil.java b/src/main/java/com/kri/common/feature/util/CommonUtil.java index ada4c48..01d4f01 100644 --- a/src/main/java/com/kri/common/feature/util/CommonUtil.java +++ b/src/main/java/com/kri/common/feature/util/CommonUtil.java @@ -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("-", ""); + } }