public static NewsCardType fromIndex(int index) { for (NewsCardType type : NewsCardType.values()) { if (type.index == index) { return type; } } return NORMAL; }
public static NewsCardType fromName(String name) { for (NewsCardType type : NewsCardType.values()) { if (type.name.equalsIgnoreCase(name)) { return type; } } return NORMAL; }