- java.lang.Object
 -  
      
- javax.management.NotificationFilterSupport
 
 
-  
       
- 实现的所有接口
 -  
         
Serializable,NotificationFilter 
- 已知直接子类:
 -  
         
MBeanServerNotificationFilter 
public class NotificationFilterSupport extends Object implements NotificationFilter
提供NotificationFilter接口的实现。 过滤在通知类型属性上执行。管理已启用通知类型的列表。 一种方法允许用户根据需要启用/禁用任意数量的通知类型。
然后,在向使用过滤器注册的侦听器发送通知之前,通知广播器将此通知类型与过滤器启用的所有通知类型进行比较。 仅当其过滤器启用此通知类型时,通知才会发送到侦听器。
例:
侦听器NotificationFilterSupport myFilter = new NotificationFilterSupport(); myFilter.enableType("my_example.my_type"); myBroadcaster.addListener(myListener, myFilter, null);myListener将仅接收其类型等于/以“my_example.my_type”开头的通知。 
-  
        
       
-  
             
构造方法摘要
构造方法 构造器 描述 NotificationFilterSupport() 
-  
             
方法摘要
所有方法 实例方法 具体的方法 变量和类型 方法 描述 voiddisableAllTypes()禁用所有通知类型。voiddisableType(String prefix)从前缀列表中删除给定的前缀。voidenableType(String prefix)启用其类型以指定前缀开头的所有通知都将发送到侦听器。Vector<String>getEnabledTypes()获取此过滤器的所有已启用通知类型。booleanisNotificationEnabled(Notification notification)在将指定通知发送到侦听器之前调用。 
 -  
             
 
-  
        
       
-  
             
方法详细信息
-  
isNotificationEnabled
public boolean isNotificationEnabled(Notification notification)
在将指定通知发送到侦听器之前调用。
此筛选器将指定通知的类型与每个启用的类型进行比较。 如果通知类型与其中一个启用的类型匹配,则应将通知发送到侦听器,此方法将返回true。- Specified by:
 -  
              
isNotificationEnabled在界面NotificationFilter - 参数
 -  
              
notification- 要发送的通知。 - 结果
 -  
              
true如果通知应该发送给监听器,否则为false。 
 
-  
enableType
public void enableType(String prefix) throws IllegalArgumentException
启用其类型以指定前缀开头的所有通知都将发送到侦听器。
如果指定的前缀已在启用的通知类型列表中,则此方法无效。例:
注意:// Enables all notifications the type of which starts with "my_example" to be sent. myFilter.enableType("my_example"); // Enables all notifications the type of which is "my_example.my_type" to be sent. myFilter.enableType("my_example.my_type");
将不匹配任何通知类型。myFilter.enableType("my_example.*");- 参数
 -  
              
prefix- 前缀。 - 异常
 -  
              
IllegalArgumentException- 前缀参数为null。 
 
-  
disableType
public void disableType(String prefix)
从前缀列表中删除给定的前缀。
如果指定的前缀不在已启用的通知类型列表中,则此方法无效。- 参数
 -  
              
prefix- 前缀。 
 
-  
disableAllTypes
public void disableAllTypes()
禁用所有通知类型。 
 -  
 
 -