E
- 監視される値の型public final class WeakListChangeListener<E> extends Object implements ListChangeListener<E>, WeakListener
ObservableList
がリスナーの弱い参照のみ保持する場合、WeakListChangeListener
を使用できます。これにより、使用後に監視されたオブジェクトからオブザーバが登録解除されない場合に発生する可能性があるメモリー・リークを回避できます。
元のListChangeListener
を渡して、WeakListChangeListener
が作成されます。監視されたオブジェクトの変更をリスニングするため、WeakListChangeListener
を登録する必要があります。
注意: 渡されたListChangeListener
への参照を、使用されている間は保持する必要があります。そうでない場合は、すぐにガベージ・コレクションされます。
ListChangeListener
, ObservableList
, WeakListener
ListChangeListener.Change<E>
コンストラクタと説明 |
---|
WeakListChangeListener(ListChangeListener<E> listener)
WeakListChangeListener のコンストラクタ。 |
修飾子と型 | メソッドと説明 |
---|---|
void |
onChanged(ListChangeListener.Change<? extends E> change)
ObservableListに対して変更が行われた後に呼び出されます。
|
boolean |
wasGarbageCollected()
リンクされたリスナーがガベージ・コレクションされた場合、
true を返します。 |
public WeakListChangeListener(ListChangeListener<E> listener)
WeakListChangeListener
のコンストラクタ。listener
- 通知される元のリスナーpublic boolean wasGarbageCollected()
true
を返します。この場合、リスナーをobservableから削除できます。WeakListener
のwasGarbageCollected
true
。public void onChanged(ListChangeListener.Change<? extends E> change)
onChanged
、インタフェース: ListChangeListener<E>
change
- 行われた変更を表すオブジェクトListChangeListener.Change
Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.