JavaTM Platform
Standard Ed. 6

javax.management
クラス NotificationFilterSupport

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」と等しいか、この文字列で始まる型の通知だけを受信します。

導入されたバージョン:
1.5
関連項目:
NotificationBroadcaster.addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object), 直列化された形式

コンストラクタの概要
NotificationFilterSupport()
           
 
メソッドの概要
 void disableAllTypes()
          すべての通知型を無効にします。
 void disableType(String prefix)
          接頭辞リストから指定された接頭辞を削除します。
 void enableType(String prefix)
          特定の接頭辞で始まるすべての通知型の通知をリスナーに送信します。
 Vector<String> getEnabledTypes()
          このフィルタ用に、すべての有効な通知型を取得します。
 boolean isNotificationEnabled(Notification notification)
          リスナーへの特定の通知の送信前に呼び出されます。
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

NotificationFilterSupport

public NotificationFilterSupport()
メソッドの詳細

isNotificationEnabled

public boolean isNotificationEnabled(Notification notification)
リスナーへの特定の通知の送信前に呼び出されます。
このフィルタは、指定された通知と、有効な型を比較します。通知型が有効な型に一致する場合、リスナーに通知が送信され、このメソッドは true を返します。

定義:
インタフェース NotificationFilter 内の isNotificationEnabled
パラメータ:
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()
すべての通知型を無効にします。


getEnabledTypes

public Vector<String> getEnabledTypes()
このフィルタ用に、すべての有効な通知型を取得します。

戻り値:
すべての有効な通知型を含むリスト

JavaTM Platform
Standard Ed. 6

バグの報告と機能のリクエスト
さらに詳しい API リファレンスおよび開発者ドキュメントについては、Java SE 開発者用ドキュメントを参照してください。開発者向けの詳細な解説、概念の概要、用語の定義、バグの回避策、およびコード実例が含まれています。

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。