public static PageType fromString(String typeDescriptor) { for (PageType type : PageType.values()) { if (type.description.equalsIgnoreCase(typeDescriptor)) { return type; } } throw new IllegalArgumentException("unknown page type descriptor: " + typeDescriptor); }
public static PageType getPageTypeForPageName(String pageName) { for (PageType type : values()) { if (type.validForPageName(pageName)) return type; } return STATIC; }