1 43 package net.jforum.security; 44 45 import java.io.Serializable ; 46 import java.util.Collection ; 47 import java.util.Iterator ; 48 import java.util.LinkedHashSet ; 49 50 54 public class RoleValueCollection extends LinkedHashSet implements Serializable 55 { 56 62 public RoleValue get(String valueName) 63 { 64 for (Iterator iter = this.iterator(); iter.hasNext(); ) { 65 RoleValue v = (RoleValue)iter.next(); 66 67 if (v.getValue().equals(valueName)) { 68 return v; 69 } 70 } 71 72 return null; 73 } 74 75 78 public boolean contains(Object o) 79 { 80 boolean c = super.contains(o); 81 return c; 82 } 83 84 87 public boolean add(Object o) 88 { 89 if (!(o instanceof RoleValue)) { 90 throw new IllegalArgumentException ("Object passed as parameter is not a RoleValue type"); 91 } 92 93 return super.add(o); 94 } 95 96 99 public boolean addAll(Collection c) 100 { 101 boolean status = true; 102 for (Iterator iter = c.iterator(); iter.hasNext(); ) { 103 status = this.add(iter.next()); 104 } 105 106 return status; 107 } 108 } 109 | Popular Tags |