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

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

There is a newer version: 1.0.13.7
Show newest version
/*
 *
 *  *********************** 版权声明 ***********************************
 *
 *  版权所有:浙江大华技术股份有限公司
 *  ©CopyRight DahuaTech 2019
 *
 *  *********************************************************************
 *
 */
package com.dahuatech.icc.brm.enums;


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

/**
 * 性别
 * 
 */
public enum SexEnum {
    UNKNOWN(0,"未知"),
	MAN(1,"男"),
	FEMALE(2,"女");
	
	private Integer id;
    private String name;

    private SexEnum(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public static SexEnum forValue(String name){
        for(SexEnum sex : values()){
            if(sex.getName().equals(name)){
                return sex;
            }
        }
        return null;
    }

    public static SexEnum forValue(Integer id){
        for(SexEnum sex : values()){
            if(sex.getId().equals(id)){
                return sex;
            }
        }
        return null;
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy