1 16 package org.outerj.daisy.books.store; 17 18 public final class BookAclSubjectType { 19 public static final BookAclSubjectType USER = new BookAclSubjectType("user"); 20 public static final BookAclSubjectType ROLE = new BookAclSubjectType("role"); 21 public static final BookAclSubjectType EVERYONE = new BookAclSubjectType("everyone"); 22 23 private final String name; 24 25 private BookAclSubjectType(String name) { 26 this.name = name; 27 } 28 29 public String toString() { 30 return name; 31 } 32 33 public static BookAclSubjectType fromString(String value) { 34 if (value.equals(USER.name)) { 35 return USER; 36 } else if (value.equals(ROLE.name)) { 37 return ROLE; 38 } else if (value.equals(EVERYONE.name)) { 39 return EVERYONE; 40 } else { 41 throw new RuntimeException ("Unrecognized BookAclSubjectType name: \"" + value + "\"."); 42 } 43 } 44 } 45 | Popular Tags |