Mistři v programování na #hovnokod

Java #85

public enum TimePeriod {
	
	NONE,
	DAILY,
	WEEKLY,
	MONTHLY,
	YEARLY;
	
	public static TimePeriod getTimePeriod(String periodStr) {
		if (null == periodStr) {
			return null;
		}
		if (0 == periodStr.length()) {
			return NONE;
		}
		if (0 == periodStr.compareToIgnoreCase("daily")) {
			return DAILY;
		}
		if (0 == periodStr.compareToIgnoreCase("weekly")) {
			return WEEKLY;
		}
		if (0 == periodStr.compareToIgnoreCase("monthly")) {
			return MONTHLY;
		}
		if (0 == periodStr.compareToIgnoreCase("yearly")) {
			return YEARLY;
		}
		return null;
	}
}

Anonymous,