me.chanjar.weixin.cp.bean.Gender Maven / Gradle / Ivy
package me.chanjar.weixin.cp.bean;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
*
* 性别枚举
* Created by BinaryWang on 2018/4/22.
*
*
* @author Binary Wang
*/
@Getter
@AllArgsConstructor
public enum Gender {
/**
* 未定义
*/
UNDEFINED("未定义", "0"),
/**
* 男
*/
MALE("男", "1"),
/**
* 女
*/
FEMALE("女", "2");
private final String genderName;
private final String code;
/**
* From code gender.
*
* @param code the code
* @return the gender
*/
public static Gender fromCode(String code) {
for (Gender a : Gender.values()) {
if (a.code.equals(code)) {
return a;
}
}
return null;
}
}