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

devutility.internal.test.data.constants.Gender Maven / Gradle / Ivy

There is a newer version: 1.3.8.1
Show newest version
package devutility.internal.test.data.constants;

import devutility.internal.annotations.Convertor;

/**
 * 
 * Gender
 * 
 * @author: Aldwin Su
 */
public enum Gender {
	/**
	 * Unknow
	 */
	UNKNOW(0),

	/**
	 * Mail
	 */
	MALE(1),

	/**
	 * Femail
	 */
	FEMALE(2);

	private int value;

	private Gender(int value) {
		this.value = value;
	}

	public int getValue() {
		return value;
	}

	@Convertor
	public static Gender parse(String value) {
		Gender[] array = Gender.values();

		for (int i = 0; i < array.length; i++) {
			if (Integer.valueOf(value) == array[i].value) {
				return array[i];
			}
		}

		return Gender.UNKNOW;
	}

	public static Gender parse(int value) {
		Gender[] array = Gender.values();

		for (int i = 0; i < array.length; i++) {
			if (value == array[i].value) {
				return array[i];
			}
		}

		return Gender.UNKNOW;
	}

	@Override
	public String toString() {
		return String.valueOf(value);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy