1 7 8 package java.security; 9 10 import java.util.*; 11 12 77 78 public abstract class PermissionCollection implements java.io.Serializable { 79 80 private static final long serialVersionUID = -6727011328946861783L; 81 82 private volatile boolean readOnly; 84 85 93 public abstract void add(Permission permission); 94 95 104 public abstract boolean implies(Permission permission); 105 106 111 public abstract Enumeration<Permission > elements(); 112 113 119 public void setReadOnly() { 120 readOnly = true; 121 } 122 123 134 public boolean isReadOnly() { 135 return readOnly; 136 } 137 138 160 public String toString() { 161 Enumeration enum_ = elements(); 162 StringBuilder sb = new StringBuilder (); 163 sb.append(super.toString()+" (\n"); 164 while (enum_.hasMoreElements()) { 165 try { 166 sb.append(" "); 167 sb.append(enum_.nextElement().toString()); 168 sb.append("\n"); 169 } catch (NoSuchElementException e){ 170 } 172 } 173 sb.append(")\n"); 174 return sb.toString(); 175 } 176 } 177 | Popular Tags |