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

com.dahuatech.icc.brm.enums.CardCategory Maven / Gradle / Ivy

There is a newer version: 1.0.13.7
Show newest version
package com.dahuatech.icc.brm.enums;

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

/**
 * 卡介质
 */
public enum CardCategory {
    // IC 卡
    IC("0","IC","IC"),
    // 有源 RFID 卡
    SOURCE_RFID("1","有源RFID", "SOURCE_RFID"),
    // CPU 卡
    CPU("2","CPU","CPU"),
    // 身份证UUID
    IDENTITY_CARD("3","身份证UUID","IDENTITY_CARD");

    private String value;
    private String name;
    private String englishName;

    CardCategory(String value, String name, String englishName) {
        this.value = value;
        this.name = name;
        this.englishName = englishName;
    }

    public String getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    public String getEnglishName() {
        return englishName;
    }

    public static String getCategoryNameByValue(String value, String language) {
        if (value == null || value.length() == 0) {
            return null;
        }
        for (CardCategory category : CardCategory.values()) {
            if (category.getValue().equals(value)) {
                if ("zh-cn".equals(language)) {
                    return category.getName();
                } else {
                    return category.getEnglishName();
                }
            }
        }
        return null;
    }

    public static String getValueByName(String name) {
        if (name == null || name.length() == 0) {
            return null;
        }
        for (CardCategory cardCategory : CardCategory.values()) {
            if (cardCategory.getName().equals(name) || cardCategory.getEnglishName().equals(name)) {
                return cardCategory.getValue();
            }
        }
        return null;
    }

    public static boolean isValueContain(String value) {
        if (value == null || value.length() == 0) {
            return false;
        }
        for (CardCategory cardCategory : CardCategory.values()) {
            if (cardCategory.getValue().equals(value)) {
                return true;
            }
        }
        return false;
    }

    public static List getNames(){
        List types = new ArrayList<>();
        for (CardCategory typeEnum : CardCategory.values()) {
            types.add(typeEnum.getName());
        }
        return types;
    }

    public static CardCategory forValue(String value) {
        if (value == null || value.length() == 0) {
            return null;
        }
        for (CardCategory cardCategory : CardCategory.values()) {
            if (cardCategory.getValue().equals(value)) {
                return cardCategory;
            }
        }
        return null;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy