All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fastchar.extjs.core.FastExtEnumHelper Maven / Gradle / Ivy

Go to download

FastChar-ExtJs is a Java Web framework that uses extjs libraries.Quickly build a background management system

There is a newer version: 2.2.2
Show newest version
package com.fastchar.extjs.core;

import com.fastchar.core.FastChar;
import com.fastchar.extjs.core.enums.FastEnumInfo;
import com.fastchar.extjs.interfaces.IFastExtEnum;

import java.util.ArrayList;
import java.util.List;

/**
 * 系统枚举工具类
 */
public class FastExtEnumHelper {

    /**
     * 获取枚举值
     *
     * @param enumName 枚举名称
     * @param id       枚举ID
     * @return FastEnumInfo
     */
    public static FastEnumInfo getEnum(String enumName, Object id) {
        try {
            IFastExtEnum enumClass = FastChar.getOverrides().singleInstance(IFastExtEnum.class, enumName);
            if (enumClass != null) {
                return enumClass.getEnum(id);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 获取枚举的所有枚举值
     * @param enumName 枚举名称
     */
    public static List getAllEnums(String enumName) throws Exception {
        IFastExtEnum enumClass = FastChar.getOverrides().singleInstance(false, IFastExtEnum.class, enumName);
        if (enumClass != null) {
            return enumClass.getEnums();
        }
        return new ArrayList<>();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy