管道基础大数据平台系统开发-【后端】-Server
13693261870
2024-03-25 b6b0cb226fcf184525ee7b36af3a09471e9c0057
src/main/java/com/lf/server/helper/EnumHelper.java
@@ -6,7 +6,7 @@
import java.lang.reflect.Method;
/**
 * 枚举类型帮助类
 * 枚举帮助类
 * @author WWW
 */
public class EnumHelper {
@@ -34,7 +34,7 @@
     * @return 返回枚举值
     */
    public static <T extends Enum<T>> T getByString(Class<T> clazz, String propertyName, String value) {
        String getterMethodName = GETTER_PREFIX + StringHelper.capitalize(propertyName);
        String getterMethodName = GETTER_PREFIX + StringHelper.firstCharToUpperCase(propertyName);
        T result = null;
        try {
            T[] arr = clazz.getEnumConstants();
@@ -47,9 +47,10 @@
                    break;
                }
            }
        } catch (Exception e) {
            log.error(e.getMessage());
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
        }
        return result;
    }
@@ -62,7 +63,7 @@
     * @return 返回枚举值
     */
    public static <T extends Enum<T>> T getByInt(Class<T> clazz, String propertyName, int value) {
        String getterMethodName = GETTER_PREFIX + StringHelper.capitalize(propertyName);
        String getterMethodName = GETTER_PREFIX + StringHelper.firstCharToUpperCase(propertyName);
        T result = null;
        try {
            T[] arr = clazz.getEnumConstants();
@@ -75,8 +76,8 @@
                    break;
                }
            }
        } catch (Exception e) {
            log.error(e.getMessage());
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
        }
        return result;
    }