Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 7 8 package javax.management; 9 10 11 import java.util.Iterator ; 14 import java.util.List ; 15 import java.util.Vector ; 16 17 43 public class NotificationFilterSupport implements NotificationFilter , java.io.Serializable { 44 45 46 private static final long serialVersionUID = 6579080007561786969L; 47 48 52 private List enabledTypes = new Vector (); 53 54 55 64 public synchronized boolean isNotificationEnabled(Notification notification) { 65 66 String type = notification.getType(); 67 68 if (type == null) { 69 return false; 70 } 71 try { 72 for (Iterator i = enabledTypes.iterator(); i.hasNext(); ) { 73 String prefix = (String )i.next(); 74 if (type.startsWith(prefix)) { 75 return true; 76 } 77 } 78 } catch (java.lang.NullPointerException e) { 79 return false; 81 } 82 return false; 83 } 84 85 110 public synchronized void enableType(String prefix) throws java.lang.IllegalArgumentException { 111 112 if (prefix == null) { 113 throw new java.lang.IllegalArgumentException ("The prefix cannot be null."); 114 } 115 if (!enabledTypes.contains(prefix)) { 116 enabledTypes.add(prefix); 117 } 118 } 119 120 127 public synchronized void disableType(String prefix) { 128 enabledTypes.remove(prefix); 129 } 130 131 134 public synchronized void disableAllTypes() { 135 enabledTypes.clear(); 136 } 137 138 139 144 public synchronized Vector getEnabledTypes() { 145 return (Vector )enabledTypes; 146 } 147 148 } 149
| Popular Tags
|