260109_01_ENH : PageRequest, PageResponse 이동, 유틸 생성, 코드 이넘 컨버터 추가 및 등록
This commit is contained in:
43
src/main/java/com/kri/common/util/CommonUtil.java
Normal file
43
src/main/java/com/kri/common/util/CommonUtil.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.kri.common.util;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public final class CommonUtil {
|
||||
|
||||
public static String uuid32() {
|
||||
return UUID.randomUUID().toString().replace("-", "");
|
||||
}
|
||||
|
||||
public static boolean isNumeric(String s) {
|
||||
if (s == null || s.isBlank()) return false;
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
if (c < '0' || c > '9') return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static short safeParseShort(String s, short def) {
|
||||
try {
|
||||
return Short.parseShort(s);
|
||||
} catch (Exception e) {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
public static int safeParseInt(String s, short def) {
|
||||
try {
|
||||
return Integer.parseInt(s);
|
||||
} catch (Exception e) {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
public static long safeParseLong(String s, short def) {
|
||||
try {
|
||||
return Long.parseLong(s);
|
||||
} catch (Exception e) {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user