package foundation.capacity; import foundation.util.Util; public enum ActorType { OrgAccount("Org"), Position("Position"), Employee("Employee"), User("User"); private ActorType(String code) { this.code = code; } public String getCode() { return code; } private String code; public static ActorType parse(String code) { if (Util.isEmpty(code)){ return User; } code = code.toLowerCase(); for (ActorType actorType : ActorType.values()) { if (actorType.getCode().equalsIgnoreCase(code)) { return actorType; } } return User; } }